Class CurrencyDatatype

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

public class CurrencyDatatype extends ValueClassNameDatatype implements NamedDatatype
  • Field Details

  • Constructor Details

    • CurrencyDatatype

      public CurrencyDatatype()
  • Method Details

    • getValue

      public Object getValue(String currencyCode)
      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:
      currencyCode - string representation of the value
      Returns:
      The value as instance of the class this datatype represents.
      See Also:
    • supportsCompare

      public boolean supportsCompare()
      Specified by:
      supportsCompare in interface ValueDatatype
      Returns:
      true if this datatype is able to compare two values.
    • 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
    • getValueName

      public String getValueName(String currencyCode)
      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
    • getValueName

      public String getValueName(String currencyCode, Locale locale)
      Description copied from interface: NamedDatatype
      Returns a short description of the value of this datatype specified by the ID. The Locale can be used for internationalization. If no locale is provide the Locale.getDefault() will be used.
      Specified by:
      getValueName in interface NamedDatatype
      Parameters:
      currencyCode - the ID for the value
      locale - the locale used for internationalization
    • getValueByName

      public Object getValueByName(String symbol)
      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.

      Specified by:
      getValueByName in interface NamedDatatype
      Parameters:
      symbol - the name representation of a value
      Returns:
      the value as instance of the class this datatype represents
    • getValueByName

      public Object getValueByName(String name, Locale locale)
      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 Locale can be used for internationalization. If no locale is provide the Locale.getDefault() will be used.

      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,Locale).

      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:
      getValueByName in interface NamedDatatype
      Parameters:
      name - the name representation of a value
      locale - the locale used for internationalization
      Returns:
      the value as instance of the class this datatype represents