Class ResourceIdentifierUtils


  • public final class ResourceIdentifierUtils
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method 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>
      io.sphere.sdk.models.ResourceIdentifier<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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • REFERENCE_TYPE_ID_FIELD

        public static final java.lang.String REFERENCE_TYPE_ID_FIELD
        See Also:
        Constant Field Values
      • REFERENCE_ID_FIELD

        public static final java.lang.String REFERENCE_ID_FIELD
        See Also:
        Constant Field Values
    • Method Detail

      • toResourceIdentifierIfNotNull

        @Nullable
        public static <T extends io.sphere.sdk.models.Referenceable<S>,​S> io.sphere.sdk.models.ResourceIdentifier<S> toResourceIdentifierIfNotNull​(@Nullable
                                                                                                                                                         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. If it is null, this method returns null.
        Type Parameters:
        T - type of the resource supplied.
        S - represents the type of the ResourceIdentifier returned.
        Parameters:
        resource - represents the resource to return as a ResourceIdentifier if not null.
        Returns:
        the supplied resource in the as a ResourceIdentifier if not null. If it is null, this method returns null.
      • isReferenceOfType

        public static boolean isReferenceOfType​(@Nonnull
                                                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.
        Parameters:
        referenceValue - JSON representation of CTP reference object
        referenceTypeId - the typeId to check of the reference is of the same type or not.
        Returns:
        true if the typeId field of the reference has the same value as referenceTypeId, otherwise, false.