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,MetaPropertyandBeanBuilder.
-
-
Field Summary
Fields Modifier and Type Field Description static SerDeserializerINSTANCESingleton.
-
Constructor Summary
Constructors Modifier Constructor Description protectedDefaultDeserializer()Creates an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectbuild(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.MetaBeanfindMetaBean(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.voidsetValue(BeanBuilder<?> builder, MetaProperty<?> metaProp, Object value)Sets the parsed value into the builder.StringtoString()
-
-
-
Field Detail
-
INSTANCE
public static final SerDeserializer INSTANCE
Singleton.
-
-
Method Detail
-
findMetaBean
public MetaBean findMetaBean(Class<?> beanType)
Description copied from interface:SerDeserializerLookup the meta-bean for the specified type.If the type is not a bean, then null may be returned.
- Specified by:
findMetaBeanin 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:SerDeserializerCreates the stateful builder that captures state as the parse progresses.This is normally a
BeanBuilderhowever any type may be returned.- Specified by:
createBuilderin 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:SerDeserializerLookup 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:
findMetaPropertyin 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:SerDeserializerSets the parsed value into the builder.- Specified by:
setValuein 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:SerDeserializerBuilds 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:
buildin 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
-
-