Class ValueFormat
- java.lang.Object
-
- com.aquima.interactions.project.impl.ValueFormat
-
- All Implemented Interfaces:
IValueFormat
,IValueMask
,Serializable
public class ValueFormat extends Object implements IValueFormat
The value format class provides an abstraction for the data type specific formatters.- Since:
- 6.3
- Author:
- O. Kerpershoek
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ValueFormat(String name, DataType type, Locale locale, String formatStr)
Constructs the value format with the required arguments.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
format(IPrimitiveValue primitiveValue)
This method formats the provided value to a string.String
getName()
This method returns the name of the value format.DataType
getType()
This method returns the data type of the value format.IPrimitiveValue
parse(String str)
This method parses the string to a primitive value.
-
-
-
Constructor Detail
-
ValueFormat
public ValueFormat(String name, DataType type, Locale locale, String formatStr)
Constructs the value format with the required arguments.- Parameters:
name
- The name of the value format.type
- The data type of the value format.locale
- The locale that should be used to take the number symbols from.formatStr
- The format pattern that should be used by the formatter.- Throws:
PatternException
- When the pattern was invalid.
-
-
Method Detail
-
getName
public String getName()
Description copied from interface:IValueMask
This method returns the name of the value format.- Specified by:
getName
in interfaceIValueMask
- Returns:
- the name of the value format.
-
getType
public DataType getType()
This method returns the data type of the value format.- Returns:
- the data type of the value format.
-
format
public String format(IPrimitiveValue primitiveValue)
Description copied from interface:IValueMask
This method formats the provided value to a string.- Specified by:
format
in interfaceIValueMask
- Parameters:
primitiveValue
- The value that should be converted to a string.- Returns:
- String representation of the primitive value.
-
parse
public IPrimitiveValue parse(String str)
Description copied from interface:IValueFormat
This method parses the string to a primitive value.- Specified by:
parse
in interfaceIValueFormat
- Parameters:
str
- The string that should be parsed.- Returns:
- The primitive value for the string.
-
-