BeanSerializerBuilder
Date: 2016-12-04

com.fasterxml.jackson.databind.ser

## Class BeanSerializerBuilder

- java.lang.Object
- - com.fasterxml.jackson.databind.ser.BeanSerializerBuilder

-     public class BeanSerializerBuilder
      extends java.lang.Object

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

- - ### Field Summary

    Fields
    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 java.lang.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 java.util.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)

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `` | `BeanSerializerBuilder(BeanDescription beanDesc)`
    `protected` | `BeanSerializerBuilder(BeanSerializerBuilder src)` Copy-constructor that may be used for sub-classing

  - ### Method Summary

    Methods
    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()`
    `java.lang.Object` | `getFilterId()`
    `ObjectIdWriter` | `getObjectIdWriter()`
    `java.util.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(java.lang.Object filterId)`
    `void` | `setObjectIdWriter(ObjectIdWriter w)`
    `void` | `setProperties(java.util.List<BeanPropertyWriter> properties)`
    `void` | `setTypeId(AnnotatedMember idProp)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### _beanDesc

          protected final BeanDescription _beanDesc

    - #### _config

          protected SerializationConfig _config

    - #### _properties

          protected java.util.List<BeanPropertyWriter> _properties

      Bean properties, in order of serialization

    - #### _filteredProperties

          protected BeanPropertyWriter[] _filteredProperties

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

    - #### _anyGetter

          protected AnyGetterWriter _anyGetter

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

    - #### _filterId

          protected java.lang.Object _filterId

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

    - #### _typeId

          protected AnnotatedMember _typeId

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

    - #### _objectIdWriter

          protected ObjectIdWriter _objectIdWriter

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

  - ### Constructor Detail

    - #### BeanSerializerBuilder

          public BeanSerializerBuilder(BeanDescription beanDesc)

    - #### BeanSerializerBuilder

          protected BeanSerializerBuilder(BeanSerializerBuilder src)

      Copy-constructor that may be used for sub-classing

  - ### Method Detail

    - #### setConfig

          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

    - #### setProperties

          public void setProperties(java.util.List<BeanPropertyWriter> properties)

    - #### setFilteredProperties

          public void setFilteredProperties(BeanPropertyWriter[] properties)

    - #### setAnyGetter

          public void setAnyGetter(AnyGetterWriter anyGetter)

    - #### setFilterId

          public void setFilterId(java.lang.Object filterId)

    - #### setTypeId

          public void setTypeId(AnnotatedMember idProp)

    - #### setObjectIdWriter

          public void setObjectIdWriter(ObjectIdWriter w)

    - #### getClassInfo

          public AnnotatedClass getClassInfo()

    - #### getBeanDescription

          public BeanDescription getBeanDescription()

    - #### getProperties

          public java.util.List<BeanPropertyWriter> getProperties()

    - #### hasProperties

          public boolean hasProperties()

    - #### getFilteredProperties

          public BeanPropertyWriter[] getFilteredProperties()

    - #### getAnyGetter

          public AnyGetterWriter getAnyGetter()

    - #### getFilterId

          public java.lang.Object getFilterId()

    - #### getTypeId

          public AnnotatedMember getTypeId()

    - #### getObjectIdWriter

          public ObjectIdWriter getObjectIdWriter()

    - #### build

          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.

    - #### createDummy

          public BeanSerializer createDummy()

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