Class ValueFormatter
java.lang.Object
com.aquima.interactions.project.impl.ValueFormatter
- All Implemented Interfaces:
IValueFormatter
,Serializable
Internal class, should not use.
This class is responsible for formatting and parsing values of specified DataType objects to their corresponding text and back.
- Since:
- 6.0
- Author:
- F. van der Meer
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionValueFormatter
(IValueFormat integerFormat, IValueFormat numberFormat, IValueFormat currencyFormat, IValueFormat percentageFormat, IValueFormat dateFormat, IValueFormat dateTimeFormat, IValueFormat booleanFormat) Constructs a Value formatter based on the specific formatter classes. -
Method Summary
Modifier and TypeMethodDescriptionformat
(IPrimitiveValue valueObject) This method formats the to a string representation.static final IValueFormatter
getSensibleDefault
(Locale locale) A sensible default for when there are no formatting options.This method parses the text to a IPrimitiveValue of the type specified by the data type argument.
-
Constructor Details
-
ValueFormatter
public ValueFormatter(IValueFormat integerFormat, IValueFormat numberFormat, IValueFormat currencyFormat, IValueFormat percentageFormat, IValueFormat dateFormat, IValueFormat dateTimeFormat, IValueFormat booleanFormat) Constructs a Value formatter based on the specific formatter classes.- Parameters:
integerFormat
- The integer number format to use for DataType.IntegernumberFormat
- The number number format to use for DataType.NumbercurrencyFormat
- The number format to use for DataType.CurrencypercentageFormat
- The number format to use for DataType.PercentagedateFormat
- The date format to use for DataType.DatedateTimeFormat
- The date format to use for DataType.DateTimebooleanFormat
- The boolean format to use for DataType.Boolean
-
-
Method Details
-
getSensibleDefault
A sensible default for when there are no formatting options.- Parameters:
locale
- the localization to use when creating the sensible default.- Returns:
- A sensible default which should always succeed.
-
format
Description copied from interface:IValueFormatter
This method formats the to a string representation.- Specified by:
format
in interfaceIValueFormatter
- Parameters:
valueObject
- The primitive value whose string representation is requested.- Returns:
- String representation of the primitive value.
-
parse
Description copied from interface:IValueFormatter
This method parses the text to a IPrimitiveValue of the type specified by the data type argument.- Specified by:
parse
in interfaceIValueFormatter
- Parameters:
text
- The input text which should be parsed. Preferably String. However some primitive object handling is included.type
- The data type to which the string should be converted.- Returns:
- The primitive value for the specified data type and text.
-