T - data type handled by this converterpublic abstract class ObjectConverter<T> extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ObjectConverter.MappedEnumConverter<T>
Object converter for pseudo-enum types backed by a map.
|
| Constructor and Description |
|---|
ObjectConverter() |
| Modifier and Type | Method and Description |
|---|---|
static <V> void |
addConverter(Class<V> type,
ObjectConverter<V> converter)
Add converter for a data type.
|
abstract T |
convertValue(String value,
Class<? extends T> datatype)
Translate an untyped (string) value to a typed value.
|
static <V> V |
getValue(Object value,
Class<V> datatype)
Converts an object to the given datatype by casting if possible, and if not
by narrowing from
String using the registered object converters. |
static <V> V |
getValue(String value,
Class<V> datatype)
Translate an untyped (string) value to a typed value.
|
public static <V> void addConverter(Class<V> type, ObjectConverter<V> converter)
type - data typeconverter - converterpublic static <V> V getValue(Object value, Class<V> datatype) throws ParseException
String using the registered object converters.V - the type of value to return.value - the value to convert.datatype - the datatype to convert to.ParseException - if narrowing was not possible.public static <V> V getValue(String value, Class<V> datatype) throws ParseException
V - data typevalue - valuedatatype - class of value typeParseException - if value cannot be parsed according to typepublic abstract T convertValue(String value, Class<? extends T> datatype) throws ParseException
value - value to convert.T.ParseException - if value cannot be parsed according to typeCopyright © 2012. All Rights Reserved.