Class ValueFormat
- All Implemented Interfaces:
Serializable
,Cloneable
- Direct Known Subclasses:
SimpleValueFormat
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.text.Format
Format.Field
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionformat
(Object data, StringBuffer toAppendTo, FieldPosition pos) Formats the given data object.Formats an array.protected abstract StringBuffer
format
(Array array, StringBuffer toAppendTo, FieldPosition pos) Formats an array.Formats an scalar.protected abstract StringBuffer
format
(Scalar scalar, StringBuffer toAppendTo, FieldPosition pos) Formats a scalar.Returns the NumberFormat used to format the numeric values.byte
Parses the string and returns a byte representation.parseByteArray
(String source) Parses the string and returns a byte array representation.double
parseDouble
(String source) Parses the string and returns a double representation.parseDoubleArray
(String source) Parses the string and returns a double array representation.int
Parses the string and returns the index in the enum.parseEnumArray
(String source, List<String> labels) Parses the string and returns an array of indexes in the enum.float
parseFloat
(String source) Parses the string and returns a float representation.parseFloatArray
(String source) Parses the string and returns a float array representation.int
Parses the string and returns an integer representation.parseIntArray
(String source) Parses the string and returns an int array representation.parseObject
(String source, ParsePosition pos) parseObject
(String source, VType reference) Parses the string given the object as a reference.short
parseShort
(String source) Parses the string and returns a short representation.parseShortArray
(String source) Parses the string and returns a short array representation.parseString
(String source) Parses the string and returns a string representation.parseStringArray
(String source) Parses the string and returns a string array representation.void
setNumberFormat
(NumberFormat numberFormat) Changes the NumberFormat used to format the numeric values.Methods inherited from class java.text.Format
clone, format, formatToCharacterIterator, parseObject
-
Constructor Details
-
ValueFormat
public ValueFormat()
-
-
Method Details
-
format
Formats the given data object. For scalars and arrays redirects to the appropriate methods. For anything else uses Object.toString(). -
format
Formats an scalar.- Parameters:
scalar
- data object to format- Returns:
- a String representation
-
format
Formats an array.- Parameters:
array
- data object to format- Returns:
- a String representation
-
format
Formats a scalar.- Parameters:
scalar
- data object to formattoAppendTo
- output bufferpos
- the field position- Returns:
- the output buffer
-
format
Formats an array.- Parameters:
array
- data object to formattoAppendTo
- output bufferpos
- the field position- Returns:
- the output buffer
-
getNumberFormat
Returns the NumberFormat used to format the numeric values. If null, it will use the NumberFormat from the value Display.- Returns:
- a NumberFormat
-
setNumberFormat
Changes the NumberFormat used to format the numeric values. If null, it will use the NumberFormat from the value Display.- Parameters:
numberFormat
- a NumberFormat
-
parseObject
- Specified by:
parseObject
in classFormat
-
parseObject
Parses the string given the object as a reference.This function will parse the string based on the object provided as a reference (e.g. if reference is a VDouble, it will parse the string as a double). The data in the reference will also be used for the actual parsing (e.g. if reference is Enum, the labels will be used to match the string).
- Parameters:
source
- the text to parsereference
- the vtype object to reference- Returns:
- the parsed representation
-
parseDouble
Parses the string and returns a double representation.Default implementation uses
Double.parseDouble(java.lang.String)
- Parameters:
source
- the text to parse- Returns:
- the parsed representation
-
parseFloat
Parses the string and returns a float representation.Default implementation uses
Float.parseFloat(java.lang.String)
- Parameters:
source
- the text to parse- Returns:
- the parsed representation
-
parseInt
Parses the string and returns an integer representation.Default implementation uses
Integer.parseInt(java.lang.String)
- Parameters:
source
- the text to parse- Returns:
- the parsed representation
-
parseShort
Parses the string and returns a short representation.Default implementation uses
Short.parseShort(java.lang.String)
- Parameters:
source
- the text to parse- Returns:
- the parsed representation
-
parseByte
Parses the string and returns a byte representation.Default implementation uses
Byte.parseByte(java.lang.String)
- Parameters:
source
- the text to parse- Returns:
- the parsed representation
-
parseString
Parses the string and returns a string representation.Default implementation returns the string.
- Parameters:
source
- the text to parse- Returns:
- the parsed representation
-
parseEnum
Parses the string and returns the index in the enum.Default implementation matches the label and returns the index.
- Parameters:
source
- the text to parselabels
- the labels for the enum- Returns:
- the parsed representation
-
parseDoubleArray
Parses the string and returns a double array representation.Default implementation expects a comma separated list, and parses each element with
parseDouble(java.lang.String)
.- Parameters:
source
- the text to parse- Returns:
- the parsed representation
-
parseFloatArray
Parses the string and returns a float array representation.Default implementation expects a comma separated list, and parses each element with
parseFloat(java.lang.String)
.- Parameters:
source
- the text to parse- Returns:
- the parsed representation
-
parseIntArray
Parses the string and returns an int array representation.Default implementation expects a comma separated list, and parses each element with
parseInt(java.lang.String)
.- Parameters:
source
- the text to parse- Returns:
- the parsed representation
-
parseShortArray
Parses the string and returns a short array representation.Default implementation expects a comma separated list, and parses each element with
parseShort(java.lang.String)
.- Parameters:
source
- the text to parse- Returns:
- the parsed representation
-
parseByteArray
Parses the string and returns a byte array representation.Default implementation expects a comma separated list, and parses each element with
parseByte(java.lang.String)
.- Parameters:
source
- the text to parse- Returns:
- the parsed representation
-
parseStringArray
Parses the string and returns a string array representation.Default implementation expects a comma separated list, and parses each element with
parseString(java.lang.String)
.- Parameters:
source
- the text to parse- Returns:
- the parsed representation
-
parseEnumArray
Parses the string and returns an array of indexes in the enum.Default implementation expects a comma separated list, and parses each element with
parseEnum(java.lang.String, java.util.List)
.- Parameters:
source
- the text to parselabels
- the labels for the enum- Returns:
- the parsed representation
-