public final class SerDeserializers extends Object
Deserializers handle situations where the data being read does not match the
bean in the classpath. See also RenameHandler.
Normally, it makes sense to customize the shared singleton instance, because the classpath is static and fixed and the transformations are common.
Implementations must be thread-safe singletons.
| Modifier and Type | Field and Description |
|---|---|
static SerDeserializers |
INSTANCE
Shared global instance which can be mutated.
|
static SerDeserializers |
LENIENT
Lenient instance which can be mutated.
|
| Constructor and Description |
|---|
SerDeserializers()
Creates an instance.
|
SerDeserializers(boolean lenient,
SerDeserializerProvider... providers)
Creates an instance using additional providers.
|
SerDeserializers(SerDeserializerProvider... providers)
Creates an instance using additional providers.
|
| Modifier and Type | Method and Description |
|---|---|
Class<?> |
decodeType(String typeStr,
JodaBeanSer settings,
String basePackage,
Map<String,Class<?>> knownTypes,
Class<?> defaultType) |
SerDeserializer |
findDeserializer(Class<?> type)
Finds the deserializer for the specified type.
|
ConcurrentMap<Class<?>,SerDeserializer> |
getDeserializers()
Gets the map of deserializers which can be modified.
|
SerDeserializers |
register(Class<?> type,
SerDeserializer deserializer)
Adds the deserializer to be used for the specified type.
|
SerDeserializers |
registerProvider(SerDeserializerProvider provider)
Adds the deserializer provider to be used.
|
String |
toString() |
public static final SerDeserializers INSTANCE
public static final SerDeserializers LENIENT
public SerDeserializers()
public SerDeserializers(SerDeserializerProvider... providers)
providers - the providers to usepublic SerDeserializers(boolean lenient,
SerDeserializerProvider... providers)
lenient - whether to deserialize lenientlyproviders - the providers to usepublic SerDeserializers register(Class<?> type, SerDeserializer deserializer)
type - the type, not nulldeserializer - the deserializer, not nullpublic ConcurrentMap<Class<?>,SerDeserializer> getDeserializers()
public SerDeserializers registerProvider(SerDeserializerProvider provider)
provider - the deserializer provider, not nullpublic SerDeserializer findDeserializer(Class<?> type)
The DefaultDeserializer is used if one has not been registered.
type - the type, not nullpublic Class<?> decodeType(String typeStr, JodaBeanSer settings, String basePackage, Map<String,Class<?>> knownTypes, Class<?> defaultType) throws ClassNotFoundException
ClassNotFoundExceptionCopyright © 2007–2017 Joda.org. All rights reserved.