public abstract class ValueFormat extends Format
Format.Field
Constructor and Description |
---|
ValueFormat() |
Modifier and Type | Method and Description |
---|---|
String |
format(Array array)
Formats an array.
|
protected abstract StringBuffer |
format(Array array,
StringBuffer toAppendTo,
FieldPosition pos)
Formats an array.
|
StringBuffer |
format(Object data,
StringBuffer toAppendTo,
FieldPosition pos)
Formats the given data object.
|
String |
format(Scalar scalar)
Formats an scalar.
|
protected abstract StringBuffer |
format(Scalar scalar,
StringBuffer toAppendTo,
FieldPosition pos)
Formats a scalar.
|
NumberFormat |
getNumberFormat()
Returns the NumberFormat used to format the numeric values.
|
byte |
parseByte(String source)
Parses the string and returns a byte representation.
|
org.epics.util.array.ListByte |
parseByteArray(String source)
Parses the string and returns a byte array representation.
|
double |
parseDouble(String source)
Parses the string and returns a double representation.
|
org.epics.util.array.ListDouble |
parseDoubleArray(String source)
Parses the string and returns a double array representation.
|
int |
parseEnum(String source,
List<String> labels)
Parses the string and returns the index in the enum.
|
org.epics.util.array.ListInt |
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.
|
org.epics.util.array.ListFloat |
parseFloatArray(String source)
Parses the string and returns a float array representation.
|
int |
parseInt(String source)
Parses the string and returns an integer representation.
|
org.epics.util.array.ListInt |
parseIntArray(String source)
Parses the string and returns an int array representation.
|
Object |
parseObject(String source,
ParsePosition pos) |
Object |
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.
|
org.epics.util.array.ListShort |
parseShortArray(String source)
Parses the string and returns a short array representation.
|
String |
parseString(String source)
Parses the string and returns a string representation.
|
List<String> |
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.
|
clone, format, formatToCharacterIterator, parseObject
public StringBuffer format(Object data, StringBuffer toAppendTo, FieldPosition pos)
public String format(Scalar scalar)
scalar
- data object to formatpublic String format(Array array)
array
- data object to formatprotected abstract StringBuffer format(Scalar scalar, StringBuffer toAppendTo, FieldPosition pos)
scalar
- data object to formattoAppendTo
- output bufferpos
- the field positionprotected abstract StringBuffer format(Array array, StringBuffer toAppendTo, FieldPosition pos)
array
- data object to formattoAppendTo
- output bufferpos
- the field positionpublic NumberFormat getNumberFormat()
public void setNumberFormat(NumberFormat numberFormat)
numberFormat
- a NumberFormatpublic Object parseObject(String source, ParsePosition pos)
parseObject
in class Format
public Object parseObject(String source, VType 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).
source
- the text to parsereference
- the vtype object to referencepublic double parseDouble(String source)
Default implementation uses Double.parseDouble(java.lang.String)
source
- the text to parsepublic float parseFloat(String source)
Default implementation uses Float.parseFloat(java.lang.String)
source
- the text to parsepublic int parseInt(String source)
Default implementation uses Integer.parseInt(java.lang.String)
source
- the text to parsepublic short parseShort(String source)
Default implementation uses Short.parseShort(java.lang.String)
source
- the text to parsepublic byte parseByte(String source)
Default implementation uses Byte.parseByte(java.lang.String)
source
- the text to parsepublic String parseString(String source)
Default implementation returns the string.
source
- the text to parsepublic int parseEnum(String source, List<String> labels)
Default implementation matches the label and returns the index.
source
- the text to parselabels
- the labels for the enumpublic org.epics.util.array.ListDouble parseDoubleArray(String source)
Default implementation expects a comma separated list, and parses
each element with parseDouble(java.lang.String)
.
source
- the text to parsepublic org.epics.util.array.ListFloat parseFloatArray(String source)
Default implementation expects a comma separated list, and parses
each element with parseFloat(java.lang.String)
.
source
- the text to parsepublic org.epics.util.array.ListInt parseIntArray(String source)
Default implementation expects a comma separated list, and parses
each element with parseInt(java.lang.String)
.
source
- the text to parsepublic org.epics.util.array.ListShort parseShortArray(String source)
Default implementation expects a comma separated list, and parses
each element with parseShort(java.lang.String)
.
source
- the text to parsepublic org.epics.util.array.ListByte parseByteArray(String source)
Default implementation expects a comma separated list, and parses
each element with parseByte(java.lang.String)
.
source
- the text to parsepublic List<String> parseStringArray(String source)
Default implementation expects a comma separated list, and parses
each element with parseString(java.lang.String)
.
source
- the text to parsepublic org.epics.util.array.ListInt parseEnumArray(String source, List<String> labels)
Default implementation expects a comma separated list, and parses
each element with parseEnum(java.lang.String, java.util.List)
.
source
- the text to parselabels
- the labels for the enumCopyright © 2010–2015. All rights reserved.