Class CustomObjectCompositeIdentifier


  • public final class CustomObjectCompositeIdentifier
    extends java.lang.Object
    This class is only meant for the internal use of the commercetools-sync-java library.

    Since there is no one unique identifier for customObjects on the commercetools API, we uniquely identify a customObject as a composite id of the following fields: key, container. This class models such composite key.

    • Method Detail

      • of

        @Nonnull
        public static CustomObjectCompositeIdentifier of​(@Nonnull
                                                         io.sphere.sdk.customobjects.CustomObjectDraft customObjectDraft)
        Given a CustomObjectDraft, creates a CustomObjectCompositeIdentifier using the following fields from the supplied CustomObjectDraft:
        1. key: key of CustomObjectDraft.getKey()
        2. container: container of CustomObjectDraft.getContainer()
        Parameters:
        customObjectDraft - a composite id is built using its fields.
        Returns:
        a composite id comprised of the fields of the supplied CustomObjectDraft.
      • of

        @Nonnull
        public static CustomObjectCompositeIdentifier of​(@Nonnull
                                                         io.sphere.sdk.customobjects.CustomObject customObject)
        Given a CustomObjectDraft, creates a CustomObjectCompositeIdentifier using the following fields from the supplied CustomObject:
        1. key: key of CustomObject.getKey()
        2. container: container of CustomObject.getContainer()
        Parameters:
        customObject - a composite id is built using its fields.
        Returns:
        a composite id comprised of the fields of the supplied CustomObject.
      • of

        @Nonnull
        public static CustomObjectCompositeIdentifier of​(@Nonnull
                                                         java.lang.String key,
                                                         @Nonnull
                                                         java.lang.String container)
        Given a String and String, creates a CustomObjectCompositeIdentifier using the following fields from the supplied attributes.
        Parameters:
        key - key of CustomerObject to build composite Id.
        container - container of CustomerObject to build composite Id.
        Returns:
        a composite id comprised of the fields of the supplied key and container.
      • of

        @Nonnull
        public static CustomObjectCompositeIdentifier of​(@Nonnull
                                                         java.lang.String identifierAsString)
        Given a String with a format "container|key", creates a CustomObjectCompositeIdentifier using the following fields from the supplied identifier as string.
        Parameters:
        identifierAsString - string format of the identifier to build composite Id.
        Returns:
        a composite id comprised of the fields of the supplied key and container.
      • getKey

        public java.lang.String getKey()
      • getContainer

        public java.lang.String getContainer()
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object