Class GenericEnumDatatype

java.lang.Object
org.faktorips.datatype.GenericValueDatatype
org.faktorips.datatype.GenericEnumDatatype
All Implemented Interfaces:
Comparable<Datatype>, Datatype, EnumDatatype, NamedDatatype, ValueDatatype
Direct Known Subclasses:
DefaultGenericEnumDatatype

public abstract class GenericEnumDatatype extends GenericValueDatatype implements EnumDatatype
Generic enum datatype. See the superclass for more Details.
Author:
Jan Ortmann
  • Field Details

  • Constructor Details

    • GenericEnumDatatype

      public GenericEnumDatatype()
  • Method Details

    • isCacheData

      public boolean isCacheData()
      Returns true if the values' id and names are cached, false otherwise.
    • setCacheData

      public void setCacheData(boolean cacheData)
      Sets to true if the values' ids and names should be cached, otherwise false. Setting false also clears the cache.
    • checkReadyToUse

      public org.faktorips.runtime.MessageList checkReadyToUse()
      Description copied from interface: ValueDatatype
      Validates the value datatype and returns a message list containing error messages if the datatype is invalid. If the datatype is valid an empty list is returned.

      Value datatypes like the predefined datatypes (defined by the constants in this class) are always valid. However generic datatypes that implement this interface might be invalid.

      Specified by:
      checkReadyToUse in interface ValueDatatype
      Overrides:
      checkReadyToUse in class GenericValueDatatype
    • getGetNameMethodName

      public String getGetNameMethodName()
      Returns the name of the getName(String) method.
    • setGetNameMethodName

      public void setGetNameMethodName(String getNameMethodName)
      Sets the name of the getName(String) method.
    • isSupportingNames

      public boolean isSupportingNames()
      Description copied from interface: NamedDatatype
      Returns true if an implementation of this interface supports names that describe the datatype's value. E.g. an enum datatype PaymentMode might return the name "annual" for the annual payment mode with ID "1". If this method returns false a call to the NamedDatatype.getValueName(String) method is supposed to throw an IllegalStateException.
      Specified by:
      isSupportingNames in interface NamedDatatype
    • setIsSupportingNames

      public void setIsSupportingNames(boolean isSupportingNames)
    • getAllValueIds

      public String[] getAllValueIds(boolean includeNull)
      Description copied from interface: EnumDatatype
      Returns the IDs of all values defined in the enum type.
      Specified by:
      getAllValueIds in interface EnumDatatype
      Parameters:
      includeNull - true to get the ID for the NULL-Value included, false for not include the NULL-Value. Note that the NULL-Value can be the Java null or a special case NULL-value ID.
    • getValueName

      public String getValueName(String id)
      Description copied from interface: NamedDatatype
      Returns a short description of the value of this datatype specified by the ID.
      Specified by:
      getValueName in interface NamedDatatype
    • getNameFromValue

      protected String getNameFromValue(Object value)
    • isParsable

      public boolean isParsable(String value)
      Description copied from interface: ValueDatatype
      Returns true if the given string can be parsed to a value of this datatype. Returns false otherwise.
      Specified by:
      isParsable in interface ValueDatatype
      Overrides:
      isParsable in class GenericValueDatatype
    • initCache

      public void initCache()
      Initializes the cache with the data from the underlying class.
    • clearCache

      protected void clearCache()
      Overrides:
      clearCache in class GenericValueDatatype