All Implemented Interfaces:
BeanProperty, Named, Serializable
Direct Known Subclasses:
UnwrappingBeanPropertyWriter, VirtualBeanPropertyWriter

public class BeanPropertyWriter extends PropertyWriter implements Serializable
Base bean property handler class, which implements common parts of reflection-based functionality for accessing a property value and serializing it.

Note that current design tries to keep instances immutable (semi-functional style); mostly because these instances are exposed to application code and this is to reduce likelihood of data corruption and synchronization issues.

See Also:
  • Field Details

    • MARKER_FOR_EMPTY

      public static final Object MARKER_FOR_EMPTY
      Marker object used to indicate "do not serialize if empty"
    • _name

      protected final SerializedString _name
      Logical name of the property; will be used as the field name under which value for the property is written.

      NOTE: do NOT change name of this field; it is accessed by Afterburner module (until 2.4; not directly from 2.5) ALSO NOTE: ... and while it really ought to be `SerializableString`, changing that is also binary-incompatible change. So nope.

    • _wrapperName

      protected final PropertyName _wrapperName
      Wrapper name to use for this element, if any
      Since:
      2.2
    • _declaredType

      protected final JavaType _declaredType
      Type property is declared to have, either in class definition or associated annotations.
    • _cfgSerializationType

      protected final JavaType _cfgSerializationType
      Type to use for locating serializer; normally same as return type of the accessor method, but may be overridden by annotations.
    • _nonTrivialBaseType

      protected JavaType _nonTrivialBaseType
      Base type of the property, if the declared type is "non-trivial"; meaning it is either a structured type (collection, map, array), or parameterized. Used to retain type information about contained type, which is mostly necessary if type meta-data is to be included.
    • _contextAnnotations

      protected final transient Annotations _contextAnnotations
      Annotations from context (most often, class that declares property, or in case of sub-class serializer, from that sub-class)

      NOTE: transient just to support JDK serializability; Annotations do not serialize. At all.

    • _member

      protected final AnnotatedMember _member
      Member (field, method) that represents property and allows access to associated annotations.
    • _accessorMethod

      protected transient Method _accessorMethod
      Accessor method used to get property value, for method-accessible properties. Null if and only if _field is null.

      `transient` (and non-final) only to support JDK serializability.

    • _field

      protected transient Field _field
      Field that contains the property value for field-accessible properties. Null if and only if _accessorMethod is null.

      `transient` (and non-final) only to support JDK serializability.

    • _serializer

      protected JsonSerializer<Object> _serializer
      Serializer to use for writing out the value: null if it cannot be known statically; non-null if it can.
    • _nullSerializer

      protected JsonSerializer<Object> _nullSerializer
      Serializer used for writing out null values, if any: if null, null values are to be suppressed.
    • _typeSerializer

      protected TypeSerializer _typeSerializer
      If property being serialized needs type information to be included this is the type serializer to use. Declared type (possibly augmented with annotations) of property is used for determining exact mechanism to use (compared to actual runtime type used for serializing actual state).
    • _dynamicSerializers

      protected transient PropertySerializerMap _dynamicSerializers
      In case serializer is not known statically (i.e. _serializer is null), we will use a lookup structure for storing dynamically resolved mapping from type(s) to serializer(s).
    • _suppressNulls

      protected final boolean _suppressNulls
      Whether null values are to be suppressed (nothing written out if value is null) or not. Note that this is a configuration value during construction, and actual handling relies on setting (or not) of _nullSerializer.
    • _suppressableValue

      protected final Object _suppressableValue
      Value that is considered default value of the property; used for default-value-suppression if enabled.
    • _includeInViews

      protected final Class<?>[] _includeInViews
      Alternate set of property writers used when view-based filtering is available for the Bean.
    • _internalSettings

      protected transient HashMap<Object,Object> _internalSettings
  • Constructor Details

  • Method Details