Class DateDatatype

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

public class DateDatatype extends ValueClassNameDatatype
A Datatype for the java.util.Date class. The string representation supported by this datatype is yyyy-MM-dd.
Author:
Peter Erzberger
  • Constructor Details

    • DateDatatype

      public DateDatatype()
      Creates a new DateDatatype where the name is the short class name.
  • Method Details

    • getValue

      public Object getValue(String value)
      Description copied from class: ValueClassNameDatatype
      This method parses the given string and returns the value as an instance of the class this value datatype represents. 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.
      Specified by:
      getValue in interface ValueDatatype
      Specified by:
      getValue in class ValueClassNameDatatype
      Parameters:
      value - string representation of the value
      Returns:
      The value as instance of the class this datatype represents.
      See Also:
    • 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 ValueClassNameDatatype
    • valueToString

      public String valueToString(Object value)
      Description copied from class: ValueClassNameDatatype
      Returns the string representation of the given value. The String value returned by this method must be parsable by the ValueClassNameDatatype.getValue(String) method.
      Specified by:
      valueToString in interface ValueDatatype
      Overrides:
      valueToString in class ValueClassNameDatatype
      Parameters:
      value - a value of this datatype
      Returns:
      the value's string representation
      See Also:
    • getDateValue

      public Date getDateValue(String value)
      Calls the getValue(String) method and casts the result to a Date.
    • supportsCompare

      public boolean supportsCompare()
      Returns:
      true if this datatype is able to compare two values.