Class EncodedItemComposedKey

java.lang.Object
de.hybris.platform.cmsfacades.uniqueidentifier.ItemComposedKey
de.hybris.platform.cmsfacades.uniqueidentifier.EncodedItemComposedKey
All Implemented Interfaces:
Serializable

public final class EncodedItemComposedKey extends ItemComposedKey
This class is used as a composed key when an itemId cannot, alone, be uniquely identified and the other attributes, such as catalog and catalog version, are needed to accomplish the task. This class provides an inner class to help building the object from a string that can either be from a JSON format or an encoded version of the JSONified string. It is guaranteed that Builder.fromEncoded(key.toEncoded()) is always equal to key.
See Also:
  • for more details about the encoding algorithm used.
  • for more details about JSON from/to object conversion.
  • Serialized Form
  • Field Details

    • BASE_ENCODING

      public static final com.google.common.io.BaseEncoding BASE_ENCODING
    • JSON_MAPPER

      public static final com.fasterxml.jackson.databind.ObjectMapper JSON_MAPPER
  • Constructor Details

    • EncodedItemComposedKey

      public EncodedItemComposedKey()
  • Method Details

    • toJsonString

      public final String toJsonString()
      Returns a json string representation of the object. It uses all its attributes to generate a Json string. For example, if you define a key with the following attributes:
              EncodedItemComposedKey itemComposedKey = new EncodedItemComposedKey();
                      itemComposedKey.setItemId("item-id");
                      itemComposedKey.setCatalogId("catalog-id");
                      itemComposedKey.setCatalogVersion("catalog-version");
       
      , this method will return a JSON string with the following format:
       {
           "itemId": "item-id",
           "catalogId": "catalog-id",
           "catalogVersion": "catalog-version"
       }
       
      Returns:
      a json string representation of the object.
    • toEncoded

      public final String toEncoded()
      Returns a Base 64 representation of the object. First it generates a JSON representation, and then it encodes with a Base64 algorithm.
           value = base64Encode(toJson(this))
       
      Returns:
      The base64 encoded representation of the JSONified string version of this object.
      See Also:
      • for more details about the encoding algorithm.