public class BeanSerializerBuilder extends Object
JsonSerializer for serializing
 intances.
 Main reason for using separate builder class is that this makes it easier
 to make actual serializer class fully immutable.| Modifier and Type | Field and Description | 
|---|---|
protected AnyGetterWriter | 
_anyGetter
Writer used for "any getter" properties, if any. 
 | 
protected BeanDescription | 
_beanDesc  | 
protected SerializationConfig | 
_config  | 
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) 
 | 
| Modifier | Constructor and Description | 
|---|---|
  | 
BeanSerializerBuilder(BeanDescription beanDesc)  | 
protected  | 
BeanSerializerBuilder(BeanSerializerBuilder src)
Copy-constructor that may be used for sub-classing 
 | 
| Modifier and Type | Method and Description | 
|---|---|
JsonSerializer<?> | 
build()
Method called to create  
BeanSerializer instance with
 all accumulated information. | 
BeanSerializer | 
createDummy()
Factory method for constructing an "empty" serializer; one that
 outputs no properties (but handles JSON objects properly, including
 type information) 
 | 
AnyGetterWriter | 
getAnyGetter()  | 
BeanDescription | 
getBeanDescription()  | 
AnnotatedClass | 
getClassInfo()  | 
BeanPropertyWriter[] | 
getFilteredProperties()  | 
Object | 
getFilterId()  | 
ObjectIdWriter | 
getObjectIdWriter()  | 
List<BeanPropertyWriter> | 
getProperties()  | 
AnnotatedMember | 
getTypeId()  | 
boolean | 
hasProperties()  | 
void | 
setAnyGetter(AnyGetterWriter anyGetter)  | 
protected void | 
setConfig(SerializationConfig config)
Initialization method called right after construction, to specify
 configuration to use. 
 | 
void | 
setFilteredProperties(BeanPropertyWriter[] properties)  | 
void | 
setFilterId(Object filterId)  | 
void | 
setObjectIdWriter(ObjectIdWriter w)  | 
void | 
setProperties(List<BeanPropertyWriter> properties)  | 
void | 
setTypeId(AnnotatedMember idProp)  | 
protected final BeanDescription _beanDesc
protected SerializationConfig _config
protected List<BeanPropertyWriter> _properties
protected BeanPropertyWriter[] _filteredProperties
protected AnyGetterWriter _anyGetter
protected Object _filterId
protected AnnotatedMember _typeId
protected ObjectIdWriter _objectIdWriter
public BeanSerializerBuilder(BeanDescription beanDesc)
protected BeanSerializerBuilder(BeanSerializerBuilder src)
protected void setConfig(SerializationConfig config)
Note: ideally should be passed in constructor, but for backwards compatibility, needed to add a setter instead
public void setProperties(List<BeanPropertyWriter> properties)
public void setFilteredProperties(BeanPropertyWriter[] properties)
properties - Number and order of properties here MUST match that
    of "regular" properties set earlier using setProperties(List); if not,
    an IllegalArgumentException will be thrownpublic void setAnyGetter(AnyGetterWriter anyGetter)
public void setFilterId(Object filterId)
public void setTypeId(AnnotatedMember idProp)
public void setObjectIdWriter(ObjectIdWriter w)
public AnnotatedClass getClassInfo()
public BeanDescription getBeanDescription()
public List<BeanPropertyWriter> getProperties()
public boolean hasProperties()
public BeanPropertyWriter[] getFilteredProperties()
public AnyGetterWriter getAnyGetter()
public Object getFilterId()
public AnnotatedMember getTypeId()
public ObjectIdWriter getObjectIdWriter()
public JsonSerializer<?> build()
BeanSerializer instance with
 all accumulated information. Will construct a serializer if we
 have enough information, or return null if not.public BeanSerializer createDummy()
Copyright © 2008–2020 FasterXML. All rights reserved.