public class ValueConverters extends Object
Provides some common value converters and value conversion helper methods.
Modifier and Type | Field and Description |
---|---|
static ValueConverter<Float,Double> |
FLOAT_CONVERTER
|
static ValueConverter<Integer,Long> |
INTEGER_CONVERTER
|
static ValueConverter<Set<String>,List<String>> |
STRING_SET_CONVERTER
|
Modifier and Type | Method and Description |
---|---|
static <V,W> V |
deserialize(ValueConverter<V,W> converter,
Object value)
Type-safe deserialization helper method.
|
static <T> ValueConverter<T,T> |
noOpConverter(Class<T> valueClass)
Creates a new type-safe no-op converter for the given class.
|
static <T> ValueConverter<T,T> |
noOpConverter(com.google.common.reflect.TypeToken<T> typeToken)
Creates a new type-safe no-op converter for the given type token.
|
static <V,W> W |
serialize(ValueConverter<V,W> converter,
V value)
Type-safe deserialization helper method.
|
public static ValueConverter<Set<String>,List<String>> STRING_SET_CONVERTER
public static ValueConverter<Integer,Long> INTEGER_CONVERTER
public static ValueConverter<Float,Double> FLOAT_CONVERTER
public static <T> ValueConverter<T,T> noOpConverter(Class<T> valueClass)
Creates a new type-safe no-op converter for the given class.
A no-op converter can be used when no conversion is required.
T
- the value typevalueClass
- the value class objectpublic static <T> ValueConverter<T,T> noOpConverter(com.google.common.reflect.TypeToken<T> typeToken)
Creates a new type-safe no-op converter for the given type token.
A no-op converter can be used when no conversion is required.
T
- the value typetypeToken
- the value type tokenpublic static <V,W> V deserialize(ValueConverter<V,W> converter, Object value)
Type-safe deserialization helper method.
V
- the transient typeW
- the serialized typeconverter
- the converter to perform the de-serialization.value
- the value to be de-serializedpublic static <V,W> W serialize(ValueConverter<V,W> converter, V value)
Type-safe deserialization helper method.
V
- the transient typeW
- the serialized typeconverter
- the converter to perform the serialization.value
- the value to be de-serializedCopyright © 2010 - 2019 edorasware ag. All Rights Reserved.