Package org.joda.beans.ser
Class DefaultDeserializer
- java.lang.Object
-
- org.joda.beans.ser.DefaultDeserializer
-
- All Implemented Interfaces:
SerDeserializer
public class DefaultDeserializer extends Object implements SerDeserializer
Default deserializer that expects the input to match the current classpath beans.This uses the standard
MetaBean
,MetaProperty
andBeanBuilder
.
-
-
Field Summary
Fields Modifier and Type Field Description static SerDeserializer
INSTANCE
Singleton.
-
Constructor Summary
Constructors Modifier Constructor Description protected
DefaultDeserializer()
Creates an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
build(Class<?> beanType, BeanBuilder<?> builder)
Builds the resulting object.BeanBuilder<?>
createBuilder(Class<?> beanType, MetaBean metaBean)
Creates the stateful builder that captures state as the parse progresses.MetaBean
findMetaBean(Class<?> beanType)
Lookup the meta-bean for the specified type.MetaProperty<?>
findMetaProperty(Class<?> beanType, MetaBean metaBean, String propertyName)
Lookup the meta-property for the specified property name.void
setValue(BeanBuilder<?> builder, MetaProperty<?> metaProp, Object value)
Sets the parsed value into the builder.String
toString()
-
-
-
Field Detail
-
INSTANCE
public static final SerDeserializer INSTANCE
Singleton.
-
-
Method Detail
-
findMetaBean
public MetaBean findMetaBean(Class<?> beanType)
Description copied from interface:SerDeserializer
Lookup the meta-bean for the specified type.If the type is not a bean, then null may be returned.
- Specified by:
findMetaBean
in interfaceSerDeserializer
- Parameters:
beanType
- the type being processed, not null- Returns:
- the meta-bean, null if not a bean type
-
createBuilder
public BeanBuilder<?> createBuilder(Class<?> beanType, MetaBean metaBean)
Description copied from interface:SerDeserializer
Creates the stateful builder that captures state as the parse progresses.This is normally a
BeanBuilder
however any type may be returned.- Specified by:
createBuilder
in interfaceSerDeserializer
- Parameters:
beanType
- the type being processed, not nullmetaBean
- the meta-bean, null if not a bean type- Returns:
- the builder, null if not interested in the parse progress
-
findMetaProperty
public MetaProperty<?> findMetaProperty(Class<?> beanType, MetaBean metaBean, String propertyName)
Description copied from interface:SerDeserializer
Lookup the meta-property for the specified property name.Return null if a property has been deleted, which will cause the parser to discard the property.
Return a non-null meta-property to parse the property. If the property was renamed, or had a type change, then the meta-property should match the property as originally stored.
- Specified by:
findMetaProperty
in interfaceSerDeserializer
- Parameters:
beanType
- the type being processed, not nullmetaBean
- the meta-bean, null if not a bean typepropertyName
- the property name being parsed, not null- Returns:
- the meta-property, null to ignore the property
-
setValue
public void setValue(BeanBuilder<?> builder, MetaProperty<?> metaProp, Object value)
Description copied from interface:SerDeserializer
Sets the parsed value into the builder.- Specified by:
setValue
in interfaceSerDeserializer
- Parameters:
builder
- the builder, null if not interested in the parse progressmetaProp
- the meta-property, not nullvalue
- the parsed value, may be null
-
build
public Object build(Class<?> beanType, BeanBuilder<?> builder)
Description copied from interface:SerDeserializer
Builds the resulting object.This method finishes the builder and returns the final object. The migrator could validate or manipulate data here once all data is parsed, for example to default a missing field.
- Specified by:
build
in interfaceSerDeserializer
- Parameters:
beanType
- the type being processed, not nullbuilder
- the builder, null if not interested in the parse progress- Returns:
- the final built object, may be null
-
-