public final class ResourceIdentifierUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
REFERENCE_ID_FIELD |
static java.lang.String |
REFERENCE_TYPE_ID_FIELD |
Modifier and Type | Method and Description |
---|---|
static boolean |
isReferenceOfType(com.fasterxml.jackson.databind.JsonNode referenceValue,
java.lang.String referenceTypeId)
Given a
JsonNode referenceValue which is the JSON representation of CTP
Reference object, this method checks if it is has a typeId with the value equal to
referenceTypeId . |
static <T extends io.sphere.sdk.models.Referenceable<S>,S> |
toResourceIdentifierIfNotNull(T resource)
Given a
Referenceable resource of the type T , if it is not null, this
method applies the Referenceable.toResourceIdentifier() method to return it as a ResourceIdentifier of the type T . |
public static final java.lang.String REFERENCE_TYPE_ID_FIELD
public static final java.lang.String REFERENCE_ID_FIELD
@Nullable public static <T extends io.sphere.sdk.models.Referenceable<S>,S> io.sphere.sdk.models.ResourceIdentifier<S> toResourceIdentifierIfNotNull(@Nullable T resource)
Referenceable
resource
of the type T
, if it is not null, this
method applies the Referenceable.toResourceIdentifier()
method to return it as a ResourceIdentifier
of the type T
. If it is null
, this method returns null
.T
- type of the resource supplied.S
- represents the type of the ResourceIdentifier
returned.resource
- represents the resource to return as a ResourceIdentifier
if not null
.ResourceIdentifier
if not null
. If it
is null
, this method returns null
.public static boolean isReferenceOfType(@Nonnull com.fasterxml.jackson.databind.JsonNode referenceValue, java.lang.String referenceTypeId)
JsonNode
referenceValue
which is the JSON representation of CTP
Reference object, this method checks if it is has a typeId
with the value equal to
referenceTypeId
.referenceValue
- JSON representation of CTP reference objectreferenceTypeId
- the typeId to check of the reference is of the same type or not.referenceTypeId
, otherwise, false.