Class EnumerationInfo

java.lang.Object
com.ptc.core.lwc.common.dynamicEnum.EnumerationInfo

public final class EnumerationInfo extends Object
This class represents an enumeration. It contains both the properties of the enumeration as well as it's entries. This class is not thread safe and should not be modified after handing it off to other code.
Note: All localizable properties should be get/set using getLocalizablePropertyValue(java.lang.String, java.util.Locale) and setLocalizableProperty(java.lang.String, java.util.Locale, java.lang.String). All non-localizable properties should be get/set using getNonLocalizablePropertyValue(java.lang.String) and setNonLocalizableProperty(java.lang.String, java.lang.Object).
Note: For all non-localizable properties, if the datatype does not match the documented datatype an error will be logged and an empty enumeration will be used.

Supported API: true

Extendable: false
  • Field Details

    • DISPLAY_NAME

      public static final String DISPLAY_NAME
      The display name of the enumeration. This is a localizable property. This is not currently displayed anywhere.

      Supported API: true
      See Also:
    • DESCRIPTION

      public static final String DESCRIPTION
      The description of the enumeration. This is a localizable property. This is not currently displayed anywhere.

      Supported API: true
      See Also:
    • TOOLTIP

      public static final String TOOLTIP
      The tooltip of the enumeration. This is a localizable property. This is not currently displayed anywhere.

      Supported API: true
      See Also:
    • DEFAULT_LOCALE

      public static final String DEFAULT_LOCALE
      Defines which locale's localized value would be used for the master text field if this was a static enumeration defined in the Enumeration Manager client. The master text value is used in certain situations when a localized value for a given locale has not been specified. This is a non-localizable property. The value for this key should be a Locale. If this property is not set, the server locale will be used.

      Supported API: true
      See Also:
    • AUTO_SORT

      public static final String AUTO_SORT
      Defines whether or not the entries of the enumeration should automatically be sorted alphabetically. If this property is set to true, then the EnumerationEntryInfo.SORT_ORDER property on the enumeration entries will be ignored. If this property is set to false, then the entries will be sorted according to their EnumerationEntryInfo.SORT_ORDER. This is a non-localizable property. The value for this key should be a Boolean. If this property is not set, it will default to false.

      Supported API: true
      See Also:
  • Method Details

    • getLocalizablePropertyNames

      public Set<String> getLocalizablePropertyNames()
      Get all localizable property names that have values defined for this EnumerationInfo.

      Supported API: true
      Returns:
      Set
    • getLocalizablePropertyValue

      public String getLocalizablePropertyValue(String propertyName, Locale locale)
      Given the property name and local, return the localizable property value. Null is returned when there is no such property value.

      Supported API: true
      Parameters:
      propertyName -
      locale -
      Returns:
      A localizable property value
    • getNonLocalizablePropertyNames

      public Set<String> getNonLocalizablePropertyNames()
      Get all non-localizable property names that have values defined for this EnumerationInfo.

      Supported API: true
      Returns:
      all non localizable property names.
    • getNonLocalizablePropertyValue

      public Object getNonLocalizablePropertyValue(String propertyName)
      Given the property name, return the non-localizable property value. Null is returned when there is no such property value.

      Supported API: true
      Parameters:
      propertyName -
      Returns:
      The non localizable property value. Null is returned if there is no such property value.
    • setNonLocalizableProperty

      public void setNonLocalizableProperty(String propertyName, Object value)
      Set the non localizable property value based on the given property name and value. When a null value is given, the original property value is removed.

      Supported API: true
      Parameters:
      propertyName - The non localizable property name. It must not be null.
      value - The non localizable property value. If the null value is given, the original property value is removed. This none-null value object must match the datatype of the given property name specified. i.e. Locale value object for DEFAULT_LOCALE property, Boolean value object for AUTO_SORT property.
      Throws:
      IllegalArgumentException - This exception is thrown when the given propertyName is null or an empty string. When the property value object datatype doesn't match the property name specified, this exception also is thrown.
    • setLocalizableProperty

      public void setLocalizableProperty(String propertyName, Locale locale, String value)
      Set the localizable property value based on the given property name, locale and value. When a null value is given, the original property value is removed.

      Supported API: true
      Parameters:
      propertyName - The localizable property. It must not be null.
      locale - The locale for this given localizable property value. It must not be null.
      value - The localizable property value. It the null value is given, the original property value is removed.
      Throws:
      IllegalArgumentException - This exception is thrown when the given name or the given locale is null, or the given name is an empty string.
    • getEnumerationEntryInfos

      public Set<EnumerationEntryInfo> getEnumerationEntryInfos()
      Return all enumeration entries hold by this enumeration info.

      Supported API: true
      Returns:
      All enumeration entries
    • addEnumerationEntryInfo

      public void addEnumerationEntryInfo(EnumerationEntryInfo entry)
      Add an enumeration entry into this enumeration info. If an enumeration entry with the same name already exists, that entry will be replaced.

      Supported API: true
      Parameters:
      entry - The enumeration entry. It must not be null.
      Throws:
      IllegalArgumentException - This exception is thrown when the given entry is null.
    • addEnumerationEntryInfos

      public void addEnumerationEntryInfos(Set<EnumerationEntryInfo> entries)
      Add an enumeration entries set into this enumeration info. If an enumeration entry with the same name already exists, that entry will be replaced.

      Supported API: true
      Parameters:
      entries - The enumeration entries set. It must not be null.
      Throws:
      IllegalArgumentException - This exception is thrown when the given entries parameter is null.