Class CustomTypeReferenceResolutionUtils
- java.lang.Object
-
- com.commercetools.sync.commons.utils.CustomTypeReferenceResolutionUtils
-
public final class CustomTypeReferenceResolutionUtils extends java.lang.ObjectUtil class which provides utilities that can be used when syncing resources from a source commercetools project to a target one.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static io.sphere.sdk.types.CustomFieldsDraftmapToCustomFieldsDraft(io.sphere.sdk.types.CustomFields custom, ReferenceIdToKeyCache referenceIdToKeyCache)Given a customCustomFields, this method provides checking to certain resources which do not extendsCustom, such asShoppingList,LineItemandTextLineItem.static <T extends io.sphere.sdk.types.Custom>
io.sphere.sdk.types.CustomFieldsDraftmapToCustomFieldsDraft(T resource, ReferenceIdToKeyCache referenceIdToKeyCache)Given a resource of typeTthat extendsCustom(i.e.
-
-
-
Method Detail
-
mapToCustomFieldsDraft
@Nullable public static <T extends io.sphere.sdk.types.Custom> io.sphere.sdk.types.CustomFieldsDraft mapToCustomFieldsDraft(@Nonnull T resource, @Nonnull ReferenceIdToKeyCache referenceIdToKeyCache)Given a resource of typeTthat extendsCustom(i.e. it hasCustomFields, this method checks if the custom fields are existing (not null) and they are reference cached(reference idToKey value stored in the map). If they are then it returns aCustomFieldsDraftinstance with the custom type key in place of the key of the reference. Otherwise, if it's not reference cached it returns aCustomFieldsDraftwithout the key. If the resource has nullCustom, then it returnsnull.- Type Parameters:
T- the type of the resource.- Parameters:
resource- the resource to replace its custom type key, if possible.referenceIdToKeyCache- the instance that manages cache.- Returns:
- an instance of
CustomFieldsDraftinstance with the custom type key, if the custom type reference was existing and reference cached on the resource. Otherwise, if its not reference cached it returns aCustomFieldsDraftwithout a key. If the resource has no or nullCustom, then it returnsnull.
-
mapToCustomFieldsDraft
@Nullable public static io.sphere.sdk.types.CustomFieldsDraft mapToCustomFieldsDraft(@Nullable io.sphere.sdk.types.CustomFields custom, @Nonnull ReferenceIdToKeyCache referenceIdToKeyCache)Given a customCustomFields, this method provides checking to certain resources which do not extendsCustom, such asShoppingList,LineItemandTextLineItem. If the custom fields are existing (not null) and they are reference cached(reference idToKey value stored in the map). If they are then it returns aCustomFieldsDraftinstance with the custom type key in place of the key of the reference. Otherwise, if it's not reference cached it returns aCustomFieldsDraftwithout the key. If the resource has nullCustom, then it returnsnull.- Parameters:
custom- the resource to replace its custom type key, if possible.referenceIdToKeyCache- the instance that manages cache.- Returns:
- an instance of
CustomFieldsDraftinstance with the custom type key, if the custom type reference was existing and reference cached on the resource. Otherwise, if its not reference cached it returns aCustomFieldsDraftwithout a key. If the resource has no or nullCustom, then it returnsnull.
-
-