|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.google.gdata.wireformats.ObjectConverter<T>
T
- data type handled by this converterpublic abstract class ObjectConverter<T>
Converts values from strings to typed values (objects).
Nested Class Summary | |
---|---|
static class |
ObjectConverter.MappedEnumConverter<T>
Object converter for pseudo-enum types backed by a map. |
Constructor Summary | |
---|---|
ObjectConverter()
|
Method Summary | ||
---|---|---|
static
|
addConverter(java.lang.Class<V> type,
ObjectConverter<V> converter)
Add converter for a data type. |
|
abstract T |
convertValue(java.lang.String value,
java.lang.Class<? extends T> datatype)
Translate an untyped (string) value to a typed value. |
|
static
|
getValue(java.lang.Object value,
java.lang.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
|
getValue(java.lang.String value,
java.lang.Class<V> datatype)
Translate an untyped (string) value to a typed value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ObjectConverter()
Method Detail |
---|
public static <V> void addConverter(java.lang.Class<V> type, ObjectConverter<V> converter)
type
- data typeconverter
- converterpublic static <V> V getValue(java.lang.Object value, java.lang.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(java.lang.String value, java.lang.Class<V> datatype) throws ParseException
V
- data typevalue
- valuedatatype
- class of value type
ParseException
- if value cannot be parsed according to typepublic abstract T convertValue(java.lang.String value, java.lang.Class<? extends T> datatype) throws ParseException
value
- value to convert.
T
.
ParseException
- if value cannot be parsed according to type
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |