Class BeanSerializerBuilder

java.lang.Object
tools.jackson.databind.ser.BeanSerializerBuilder

public class BeanSerializerBuilder extends Object
Builder class used for aggregating deserialization information about a POJO, in order to build a ValueSerializer for serializing instances. Main reason for using separate builder class is that this makes it easier to make actual serializer class fully immutable.
  • Field Details

    • _beanDescRef

      protected final BeanDescription.Supplier _beanDescRef
    • _config

      protected final SerializationConfig _config
    • _properties

      protected 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 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 Details

  • Method Details

    • setProperties

      public void setProperties(List<BeanPropertyWriter> properties)
    • setFilteredProperties

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

      public void setAnyGetter(AnyGetterWriter anyGetter)
    • setFilterId

      public void setFilterId(Object filterId)
    • setTypeId

      public void setTypeId(AnnotatedMember idProp)
    • setObjectIdWriter

      public void setObjectIdWriter(ObjectIdWriter w)
    • getClassInfo

      public AnnotatedClass getClassInfo()
    • getBeanDescriptionRef

      public BeanDescription.Supplier getBeanDescriptionRef()
    • getProperties

      public List<BeanPropertyWriter> getProperties()
    • hasProperties

      public boolean hasProperties()
    • getFilteredProperties

      public BeanPropertyWriter[] getFilteredProperties()
    • getAnyGetter

      public AnyGetterWriter getAnyGetter()
    • getFilterId

      public Object getFilterId()
    • getTypeId

      public AnnotatedMember getTypeId()
    • getObjectIdWriter

      public ObjectIdWriter getObjectIdWriter()
    • build

      public ValueSerializer<?> 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)