java.lang.Object
de.hybris.platform.integrationservices.util.files.PropertyKey

public class PropertyKey extends Object
Represents a property key in a localization bundle file.
  • Constructor Summary

    Constructors
    Constructor
    Description
    PropertyKey(@NotNull String key)
    Instantiates this property key.
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    asAttributeProperty(String typeCode, String attributeName)
    Retrieves required property presentation for the specified item attribute.
    static String
    Retrieves required property presentation for the specified item type.
    boolean
     
    Retrieves name of the item type attribute localized by this property key.
    Retrieves item type, for which this property key is.
    @NotNull String
    Retrieves the property key value as it appears in the localization properties file.
    int
     
    boolean
    Determines whether this property is for an item attribute localization.
    boolean
    Determines whether this property is for an item type localization.
    boolean
    Some localization properties for types and attributes are optional.
    boolean
    Determines whether this key is valid in the context of an extension localization file.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • PropertyKey

      public PropertyKey(@NotNull @NotNull String key)
      Instantiates this property key.
      Parameters:
      key - the full property key as it appears in the localization file, e.g. "type.Product.name"
  • Method Details

    • getItemType

      public String getItemType()
      Retrieves item type, for which this property key is.
      Returns:
      segment of the property key containing the item type name or null, if this property is not for an item type localization.
    • getAttributeName

      public String getAttributeName()
      Retrieves name of the item type attribute localized by this property key.
      Returns:
      segment of the property containing the attribute name or null, if this property is not for an attribute localization
    • getKeyString

      @NotNull public @NotNull String getKeyString()
      Retrieves the property key value as it appears in the localization properties file.
      Returns:
      the string value of the key, e.g. "type.IntegrationObject.name"
    • isItemType

      public boolean isItemType()
      Determines whether this property is for an item type localization.
      Returns:
      true, if this property is in one of the following formats:
      • type.<type_code>.name
      • type.<type_code>.description
      or false otherwise.
    • isAttribute

      public boolean isAttribute()
      Determines whether this property is for an item attribute localization.
      Returns:
      true, if this property is in one of the following formats:
      • type.<type_code>.<attribute_name>.name
      • type.<type_code>.<attribute_name>.description
      or false otherwise.
    • isValid

      public boolean isValid()
      Determines whether this key is valid in the context of an extension localization file.
      Returns:
      true, if the property key is either for an item type or for an item type attribute.
      See Also:
    • isRequired

      public boolean isRequired()
      Some localization properties for types and attributes are optional. Only properties ending with ".name" are required for localization purposes. This method determines whether this property key represents a required or an optional localization property.
      Returns:
      true, if this property is required to be present in a localization file; false, if it's optional.
    • asItemProperty

      public static String asItemProperty(String typeCode)
      Retrieves required property presentation for the specified item type.
      Parameters:
      typeCode - a type code for an item to get the corresponding localization property for
      Returns:
      localization property key as it would be returned by getKeyString() method, if there was a PropertyKey for the specified item
    • asAttributeProperty

      public static String asAttributeProperty(String typeCode, String attributeName)
      Retrieves required property presentation for the specified item attribute.
      Parameters:
      typeCode - type code of the item containing the specified attribute.
      attributeName - name of the attribute to get the corresponding localization property for
      Returns:
      localization property key as it would be returned by getKeyString() method, if there was a PropertyKey for the specified attribute.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object