public final class CustomTypeReferenceReplacementUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static <T extends io.sphere.sdk.types.Custom> |
replaceCustomTypeIdWithKeys(T resource)
Given a resource of type
T that extends Custom (i.e. |
@Nullable
public static <T extends io.sphere.sdk.types.Custom> io.sphere.sdk.types.CustomFieldsDraft replaceCustomTypeIdWithKeys(@Nonnull
T resource)
T that extends Custom (i.e. it has CustomFields, this method
checks if the custom fields are existing (not null) and they are reference expanded. If they are then
it returns a CustomFieldsDraft instance with the custom type key in place of the id of the reference.
Otherwise, if it's not reference expanded it returns a CustomFieldsDraft with the id not replaced. If the
resource has null Custom, then it returns null.T - the type of the resource.resource - the resource to replace its custom type id, if possible.CustomFieldsDraft instance with the custom type key in place of the id, if the
custom type reference was existing and reference expanded on the resource. Otherwise, if its not
reference expanded it returns a CustomFieldsDraft with the id not replaced with key. If the
resource has no or null Custom, then it returns null.