Top Description Fields Constructors Methods
com.fasterxml.jackson.databind.ser

public Class BeanSerializerBuilder

extends Object
Class Inheritance
Imports
java.util.*, com.fasterxml.jackson.databind.*, com.fasterxml.jackson.databind.introspect.AnnotatedClass, .AnnotatedMember, com.fasterxml.jackson.databind.ser.impl.ObjectIdWriter

Builder class used for aggregating deserialization information about a POJO, in order to build a JsonSerializer for serializing instances. Main reason for using separate builder class is that this makes it easier to make actual serializer class fully immutable.

Field Summary

Modifier and TypeField and Description
protected AnyGetterWriter
_anyGetter

Writer used for "any getter" properties, if any.

protected final BeanDescription
protected SerializationConfig
protected BeanPropertyWriter[]
_filteredProperties

Optional array of filtered property writers; if null, no view-based filtering is performed.

protected Object
_filterId

Id of the property filter to use for POJO, if any.

protected ObjectIdWriter
_objectIdWriter

Object responsible for serializing Object Ids for the handled type, if any.

protected List<BeanPropertyWriter>
_properties

Bean properties, in order of serialization

protected AnnotatedMember
_typeId

Property that is used for type id (and not serialized as regular property)

private static final BeanPropertyWriter[]

Constructor Summary

AccessConstructor and Description
public
protected
BeanSerializerBuilder(BeanSerializerBuilder src)

Copy-constructor that may be used for sub-classing

Method Summary

Modifier and TypeMethod and Description
public JsonSerializer<?>
build()

Method called to create BeanSerializer instance with all accumulated information.

public BeanSerializer
createDummy()
References Deprecated BeanSerializer is deprecated or references (maybe indirectly) at least one deprecated element.

Factory method for constructing an "empty" serializer; one that outputs no properties (but handles JSON objects properly, including type information)

public AnyGetterWriter
public BeanDescription
public AnnotatedClass
public BeanPropertyWriter[]
public Object
public ObjectIdWriter
public List<BeanPropertyWriter>
public AnnotatedMember
public boolean
public void
protected void
setConfig(SerializationConfig config)

Initialization method called right after construction, to specify configuration to use.

public void
setFilteredProperties(BeanPropertyWriter[]
Number and order of properties here MUST match that of "regular" properties set earlier using setProperties(List); if not, an IllegalArgumentException will be thrown
properties
)

public void
setFilterId(Object filterId)

public void
public void
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_anyGetterback to summary
protected AnyGetterWriter _anyGetter

Writer used for "any getter" properties, if any.

_beanDescback to summary
protected final BeanDescription _beanDesc
_configback to summary
protected SerializationConfig _config
_filteredPropertiesback to summary
protected BeanPropertyWriter[] _filteredProperties

Optional array of filtered property writers; if null, no view-based filtering is performed.

_filterIdback to summary
protected Object _filterId

Id of the property filter to use for POJO, if any.

_objectIdWriterback to summary
protected ObjectIdWriter _objectIdWriter

Object responsible for serializing Object Ids for the handled type, if any.

_propertiesback to summary
protected List<BeanPropertyWriter> _properties

Bean properties, in order of serialization

_typeIdback to summary
protected AnnotatedMember _typeId

Property that is used for type id (and not serialized as regular property)

NO_PROPERTIESback to summary
private static final BeanPropertyWriter[] NO_PROPERTIES

Constructor Detail

BeanSerializerBuilderback to summary
public BeanSerializerBuilder(BeanDescription beanDesc)
BeanSerializerBuilderback to summary
protected BeanSerializerBuilder(BeanSerializerBuilder src)

Copy-constructor that may be used for sub-classing

Method Detail

buildback to summary
public JsonSerializer<?> build()

Method called to create BeanSerializer instance with all accumulated information. Will construct a serializer if we have enough information, or return null if not.

createDummyback to summary
public BeanSerializer createDummy()

References Deprecated

BeanSerializer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Factory method for constructing an "empty" serializer; one that outputs no properties (but handles JSON objects properly, including type information)

getAnyGetterback to summary
public AnyGetterWriter getAnyGetter()
getBeanDescriptionback to summary
public BeanDescription getBeanDescription()
getClassInfoback to summary
public AnnotatedClass getClassInfo()
getFilteredPropertiesback to summary
public BeanPropertyWriter[] getFilteredProperties()
getFilterIdback to summary
public Object getFilterId()
getObjectIdWriterback to summary
public ObjectIdWriter getObjectIdWriter()
getPropertiesback to summary
public List<BeanPropertyWriter> getProperties()
getTypeIdback to summary
public AnnotatedMember getTypeId()
hasPropertiesback to summary
public boolean hasProperties()
setAnyGetterback to summary
public void setAnyGetter(AnyGetterWriter anyGetter)
setConfigback to summary
protected void setConfig(SerializationConfig config)

Initialization method called right after construction, to specify configuration to use.

Note

ideally should be passed in constructor, but for backwards compatibility, needed to add a setter instead

Since
2.1
setFilteredPropertiesback to summary
public void setFilteredProperties(BeanPropertyWriter[] properties)
Parameters
properties:BeanPropertyWriter[]

Number and order of properties here MUST match that of "regular" properties set earlier using setProperties(List); if not, an IllegalArgumentException will be thrown

setFilterIdback to summary
public void setFilterId(Object filterId)
setObjectIdWriterback to summary
public void setObjectIdWriter(ObjectIdWriter w)
setPropertiesback to summary
public void setProperties(List<BeanPropertyWriter> properties)
setTypeIdback to summary
public void setTypeId(AnnotatedMember idProp)