Class DefaultGenericEnumDatatype

All Implemented Interfaces:
Comparable<Datatype>, Datatype, EnumDatatype, NamedDatatype, ValueDatatype

public class DefaultGenericEnumDatatype extends GenericEnumDatatype
  • Constructor Details

    • DefaultGenericEnumDatatype

      public DefaultGenericEnumDatatype(Class<?> adaptedClass)
  • Method Details

    • getAdaptedClass

      public Class<?> getAdaptedClass()
      Description copied from class: GenericValueDatatype
      Returns the class represented by this datatype. If the class can't be found, null is returned. In this case the validate() method returns a message list containing an error message.
      Specified by:
      getAdaptedClass in class GenericValueDatatype
    • getAdaptedClassName

      public String getAdaptedClassName()
      Description copied from class: GenericValueDatatype
      Returns the name of the class represented by this datatype. This method must return a value, even if the class itself can't be found.
      Specified by:
      getAdaptedClassName in class GenericValueDatatype
    • getValueByName

      public Object getValueByName(String name)
      Description copied from interface: NamedDatatype
      This method parses the given string and returns the value as an instance of the class this value datatype represents.

      The difference to ValueDatatype.getValue(String) is that the given string is not a representation of the ID (as used by ValueDatatype.getValue(String)) but of the name as returned by NamedDatatype.getValueName(String).

      Use with caution: During development time Faktor-IPS maintains all values with their string representation. This allows to change the value's datatype without the need to convert the value from one class to another (e.g. if the string representation is 42 you can change the datatype from integer to string without converting the integer object to a string object.

      Parameters:
      name - the name representation of a value
      Returns:
      the value as instance of the class this datatype represents