Top Description Fields Constructors Methods
tools.jackson.databind.introspect

public Class BasicBeanDescription

extends BeanDescription
Class Inheritance
Imports
java.util.*, com.fasterxml.jackson.annotation.JsonCreator, .JsonFormat, .JsonInclude, tools.jackson.databind.*, tools.jackson.databind.cfg.MapperConfig, tools.jackson.databind.util.Annotations, .ClassUtil

Default BeanDescription implementation used by Jackson.

Although sub-classing is a theoretical possibility there are no known use cases for that, nor is such usage tested or supported. Separation from API is mostly to isolate some implementation details here and keep API simple.

Field Summary

Modifier and TypeField and Description
protected transient JsonFormat.Value
_classFormat

Results of introspecting `@JsonFormat` configuration for class, if any.

protected final AnnotatedClass
_classInfo

Information collected about the class introspected.

protected final MapperConfig<?>
protected Class<?>[]
protected boolean
protected final AnnotationIntrospector
protected ObjectIdInfo
_objectIdInfo

Details of Object Id to include, if any

protected final POJOPropertiesCollector
_propCollector

We will hold a reference to the collector in cases where information is lazily accessed and constructed; properties are only accessed when they are actually needed.

protected List<BeanPropertyDefinition>
_properties

Properties collected for the POJO; initialized as needed.

private static final Class<?>[]
Inherited from tools.jackson.databind.BeanDescription:
_type

Constructor Summary

AccessConstructor and Description
protected
protected
BasicBeanDescription(MapperConfig<?> config, JavaType type, AnnotatedClass classDef)

Alternate constructor used in cases where property information is not needed, only class info.

protected

Method Summary

Modifier and TypeMethod and Description
protected List<BeanPropertyDefinition>
public boolean
public AnnotatedMember
findAnyGetter()

Implements abstract tools.jackson.databind.BeanDescription.findAnyGetter.

Method used to locate the method of introspected class that implements com.fasterxml.jackson.annotation.JsonAnyGetter.

public AnnotatedMember
findAnySetterAccessor()

Implements abstract tools.jackson.databind.BeanDescription.findAnySetterAccessor.

Method used to locate a mutator (settable field, or 2-argument set method) of introspected class that implements com.fasterxml.jackson.annotation.JsonAnySetter.

public List<BeanPropertyDefinition>
findBackReferences()

Implements abstract tools.jackson.databind.BeanDescription.findBackReferences.

Method for locating all back-reference properties (setters, fields) bean has

public AnnotatedConstructor
findDefaultConstructor()

Implements abstract tools.jackson.databind.BeanDescription.findDefaultConstructor.

Method that will locate the no-arg constructor for this class, if it has one, and that constructor has not been marked as ignorable.

public Class<?>[]
findDefaultViews()

Implements abstract tools.jackson.databind.BeanDescription.findDefaultViews.

Method for finding out if the POJO specifies default view(s) to use for properties, considering both per-type annotations and global default settings.

protected AnnotatedAndMetadata<AnnotatedMethod, JsonCreator.Mode>
public Map<Object, AnnotatedMember>
public AnnotatedMember
findJsonKeyAccessor()

Overrides tools.jackson.databind.BeanDescription.findJsonKeyAccessor.

Method for locating accessor (readable field, or "getter" method) that has com.fasterxml.jackson.annotation.JsonKey annotation, if any.

public AnnotatedMember
findJsonValueAccessor()

Implements abstract tools.jackson.databind.BeanDescription.findJsonValueAccessor.

Method for locating accessor (readable field, or "getter" method) that has com.fasterxml.jackson.annotation.JsonValue annotation, if any.

public AnnotatedMethod
findMethod(String name, Class<?>[] paramTypes)

Implements abstract tools.jackson.databind.BeanDescription.findMethod.

public List<BeanPropertyDefinition>
public BeanPropertyDefinition
public JsonInclude.Value
findPropertyInclusion(JsonInclude.Value defValue)

Implements abstract tools.jackson.databind.BeanDescription.findPropertyInclusion.

Method for determining whether null properties should be written out for a Bean of introspected type.

public static BasicBeanDescription
forDeserialization(POJOPropertiesCollector coll)

Factory method to use for constructing an instance to use for building deserializers.

public static BasicBeanDescription
forOtherUse(MapperConfig<?> config, JavaType type, AnnotatedClass ac)

Factory method to use for constructing an instance to use for purposes other than building serializers or deserializers; will only have information on class, not on properties.

public static BasicBeanDescription
forSerialization(POJOPropertiesCollector coll)

Factory method to use for constructing an instance to use for building serializers.

public Annotations
getClassAnnotations()

Implements abstract tools.jackson.databind.BeanDescription.getClassAnnotations.

Method for accessing collection of annotations the bean class has.

public AnnotatedClass
getClassInfo()

Implements abstract tools.jackson.databind.BeanDescription.getClassInfo.

Method for accessing low-level information about Class this item describes.

public List<AnnotatedConstructor>
getConstructors()

Implements abstract tools.jackson.databind.BeanDescription.getConstructors.

Helper method that will return all non-default constructors (that is, constructors that take one or more arguments) this class has.

public List<AnnotatedAndMetadata<AnnotatedConstructor, JsonCreator.Mode>>
getConstructorsWithMode()

Implements abstract tools.jackson.databind.BeanDescription.getConstructorsWithMode.

Method similar to getConstructors() except will also introspect JsonCreator.Mode and filter out ones marked as not applicable and include mode (or lack thereof) for remaining constructors.

public List<AnnotatedMethod>
getFactoryMethods()

Implements abstract tools.jackson.databind.BeanDescription.getFactoryMethods.

Helper method that will check all static methods of the bean class that seem like factory methods eligible to be used as Creators.

public List<AnnotatedAndMetadata<AnnotatedMethod, JsonCreator.Mode>>
getFactoryMethodsWithMode()

Implements abstract tools.jackson.databind.BeanDescription.getFactoryMethodsWithMode.

Method similar to getFactoryMethods() but will return JsonCreator.Mode metadata along with qualifying factory method candidates.

public Set<String>
public ObjectIdInfo
getObjectIdInfo()

Implements abstract tools.jackson.databind.BeanDescription.getObjectIdInfo.

Accessor for getting information about Object Id expected to be used for this POJO type, if any.

public PotentialCreators
getPotentialCreators()

Implements abstract tools.jackson.databind.BeanDescription.getPotentialCreators.

Method that is replacing earlier Creator introspection access methods.

public boolean
hasKnownClassAnnotations()

Implements abstract tools.jackson.databind.BeanDescription.hasKnownClassAnnotations.

Method for checking whether class being described has any annotations recognized by registered annotation introspector.

public boolean
public Object
instantiateBean(boolean fixAccess)

Implements abstract tools.jackson.databind.BeanDescription.instantiateBean.

Method called to create a "default instance" of the bean, currently only needed for obtaining default field values which may be used for suppressing serialization of fields that have "not changed".

protected boolean
public boolean
removeProperty(String propName)

Method that can be used to prune unwanted properties, during construction of serializers and deserializers.

public BeanDescription.Supplier
supplier()

Implements abstract tools.jackson.databind.BeanDescription.supplier.

Method for constructing a supplier for this bean description instance: sometimes needed when code expects supplier, not description instance.

Inherited from tools.jackson.databind.BeanDescription:
getBeanClassgetTypeisNonStaticInnerClassisRecordType

Field Detail

_classFormatback to summary
protected transient JsonFormat.Value _classFormat

Results of introspecting `@JsonFormat` configuration for class, if any.

Since
3.0
_classInfoback to summary
protected final AnnotatedClass _classInfo

Information collected about the class introspected.

_configback to summary
protected final MapperConfig<?> _config
_defaultViewsback to summary
protected Class<?>[] _defaultViews
_defaultViewsResolvedback to summary
protected boolean _defaultViewsResolved
_intrback to summary
protected final AnnotationIntrospector _intr
_objectIdInfoback to summary
protected ObjectIdInfo _objectIdInfo

Details of Object Id to include, if any

_propCollectorback to summary
protected final POJOPropertiesCollector _propCollector

We will hold a reference to the collector in cases where information is lazily accessed and constructed; properties are only accessed when they are actually needed.

_propertiesback to summary
protected List<BeanPropertyDefinition> _properties

Properties collected for the POJO; initialized as needed.

NO_VIEWSback to summary
private static final Class<?>[] NO_VIEWS

Constructor Detail

BasicBeanDescriptionback to summary
protected BasicBeanDescription(POJOPropertiesCollector coll, JavaType type, AnnotatedClass classDef)
BasicBeanDescriptionback to summary
protected BasicBeanDescription(MapperConfig<?> config, JavaType type, AnnotatedClass classDef)

Alternate constructor used in cases where property information is not needed, only class info.

BasicBeanDescriptionback to summary
protected BasicBeanDescription(POJOPropertiesCollector coll)

Method Detail

_propertiesback to summary
protected List<BeanPropertyDefinition> _properties()
addPropertyback to summary
public boolean addProperty(BeanPropertyDefinition def)
findAnyGetterback to summary
public AnnotatedMember findAnyGetter() throws IllegalArgumentException

Implements abstract tools.jackson.databind.BeanDescription.findAnyGetter.

Method used to locate the method of introspected class that implements com.fasterxml.jackson.annotation.JsonAnyGetter. If no such method exists null is returned. If more than one are found, an exception is thrown.

Annotations
@Override
findAnySetterAccessorback to summary
public AnnotatedMember findAnySetterAccessor() throws IllegalArgumentException

Implements abstract tools.jackson.databind.BeanDescription.findAnySetterAccessor.

Doc from tools.jackson.databind.BeanDescription.findAnySetterAccessor.

Method used to locate a mutator (settable field, or 2-argument set method) of introspected class that implements com.fasterxml.jackson.annotation.JsonAnySetter. If no such mutator exists null is returned. If more than one are found, an exception is thrown. Additional checks are also made to see that method signature is acceptable: needs to take 2 arguments, first one String or Object; second any can be any type.

Annotations
@Override
findBackReferencesback to summary
public List<BeanPropertyDefinition> findBackReferences()

Implements abstract tools.jackson.databind.BeanDescription.findBackReferences.

Doc from tools.jackson.databind.BeanDescription.findBackReferences.

Method for locating all back-reference properties (setters, fields) bean has

Annotations
@Override
findDefaultConstructorback to summary
public AnnotatedConstructor findDefaultConstructor()

Implements abstract tools.jackson.databind.BeanDescription.findDefaultConstructor.

Doc from tools.jackson.databind.BeanDescription.findDefaultConstructor.

Method that will locate the no-arg constructor for this class, if it has one, and that constructor has not been marked as ignorable.

Annotations
@Override
findDefaultViewsback to summary
public Class<?>[] findDefaultViews()

Implements abstract tools.jackson.databind.BeanDescription.findDefaultViews.

Doc from tools.jackson.databind.BeanDescription.findDefaultViews.

Method for finding out if the POJO specifies default view(s) to use for properties, considering both per-type annotations and global default settings.

Annotations
@Override
findFactoryMethodMetadataback to summary
protected AnnotatedAndMetadata<AnnotatedMethod, JsonCreator.Mode> findFactoryMethodMetadata(AnnotatedMethod am)
findInjectablesback to summary
public Map<Object, AnnotatedMember> findInjectables()

Implements abstract tools.jackson.databind.BeanDescription.findInjectables.

Annotations
@Override
findJsonKeyAccessorback to summary
public AnnotatedMember findJsonKeyAccessor()

Overrides tools.jackson.databind.BeanDescription.findJsonKeyAccessor.

Doc from tools.jackson.databind.BeanDescription.findJsonKeyAccessor.

Method for locating accessor (readable field, or "getter" method) that has com.fasterxml.jackson.annotation.JsonKey annotation, if any. If multiple ones are found, an error is reported by throwing IllegalArgumentException

Annotations
@Override
findJsonValueAccessorback to summary
public AnnotatedMember findJsonValueAccessor()

Implements abstract tools.jackson.databind.BeanDescription.findJsonValueAccessor.

Doc from tools.jackson.databind.BeanDescription.findJsonValueAccessor.

Method for locating accessor (readable field, or "getter" method) that has com.fasterxml.jackson.annotation.JsonValue annotation, if any. If multiple ones are found, an error is reported by throwing IllegalArgumentException

Annotations
@Override
findMethodback to summary
public AnnotatedMethod findMethod(String name, Class<?>[] paramTypes)

Implements abstract tools.jackson.databind.BeanDescription.findMethod.

Annotations
@Override
findPropertiesback to summary
public List<BeanPropertyDefinition> findProperties()

Implements abstract tools.jackson.databind.BeanDescription.findProperties.

Annotations
@Override
findPropertyback to summary
public BeanPropertyDefinition findProperty(PropertyName name)
findPropertyInclusionback to summary
public JsonInclude.Value findPropertyInclusion(JsonInclude.Value defValue)

Implements abstract tools.jackson.databind.BeanDescription.findPropertyInclusion.

Method for determining whether null properties should be written out for a Bean of introspected type. This is based on global feature (lowest priority, passed as argument) and per-class annotation (highest priority).

Annotations
@Override
forDeserializationback to summary
public static BasicBeanDescription forDeserialization(POJOPropertiesCollector coll)

Factory method to use for constructing an instance to use for building deserializers.

forOtherUseback to summary
public static BasicBeanDescription forOtherUse(MapperConfig<?> config, JavaType type, AnnotatedClass ac)

Factory method to use for constructing an instance to use for purposes other than building serializers or deserializers; will only have information on class, not on properties.

forSerializationback to summary
public static BasicBeanDescription forSerialization(POJOPropertiesCollector coll)

Factory method to use for constructing an instance to use for building serializers.

getClassAnnotationsback to summary
public Annotations getClassAnnotations()

Implements abstract tools.jackson.databind.BeanDescription.getClassAnnotations.

Doc from tools.jackson.databind.BeanDescription.getClassAnnotations.

Method for accessing collection of annotations the bean class has.

Annotations
@Override
getClassInfoback to summary
public AnnotatedClass getClassInfo()

Implements abstract tools.jackson.databind.BeanDescription.getClassInfo.

Doc from tools.jackson.databind.BeanDescription.getClassInfo.

Method for accessing low-level information about Class this item describes.

Annotations
@Override
getConstructorsback to summary
public List<AnnotatedConstructor> getConstructors()

Implements abstract tools.jackson.databind.BeanDescription.getConstructors.

Doc from tools.jackson.databind.BeanDescription.getConstructors.

Helper method that will return all non-default constructors (that is, constructors that take one or more arguments) this class has.

Annotations
@Override
getConstructorsWithModeback to summary
public List<AnnotatedAndMetadata<AnnotatedConstructor, JsonCreator.Mode>> getConstructorsWithMode()

Implements abstract tools.jackson.databind.BeanDescription.getConstructorsWithMode.

Doc from tools.jackson.databind.BeanDescription.getConstructorsWithMode.

Method similar to getConstructors() except will also introspect JsonCreator.Mode and filter out ones marked as not applicable and include mode (or lack thereof) for remaining constructors.

Note that no other filtering (regarding visibility or other annotations) is performed

Annotations
@Override
getFactoryMethodsback to summary
public List<AnnotatedMethod> getFactoryMethods()

Implements abstract tools.jackson.databind.BeanDescription.getFactoryMethods.

Doc from tools.jackson.databind.BeanDescription.getFactoryMethods.

Helper method that will check all static methods of the bean class that seem like factory methods eligible to be used as Creators. This requires that the static method:

  1. Returns type compatible with bean type (same or subtype)
  2. Is recognized from either explicit annotation (usually @JsonCreator OR naming: names valueOf() and fromString() are recognized but only for 1-argument factory methods, and in case of fromString() argument type must further be either String or CharSequence.
Note that caller typically applies further checks for things like visibility.
Annotations
@Override
getFactoryMethodsWithModeback to summary
public List<AnnotatedAndMetadata<AnnotatedMethod, JsonCreator.Mode>> getFactoryMethodsWithMode()

Implements abstract tools.jackson.databind.BeanDescription.getFactoryMethodsWithMode.

Doc from tools.jackson.databind.BeanDescription.getFactoryMethodsWithMode.

Method similar to getFactoryMethods() but will return JsonCreator.Mode metadata along with qualifying factory method candidates.

Annotations
@Override
getIgnoredPropertyNamesback to summary
public Set<String> getIgnoredPropertyNames()

Implements abstract tools.jackson.databind.BeanDescription.getIgnoredPropertyNames.

Annotations
@Override
getObjectIdInfoback to summary
public ObjectIdInfo getObjectIdInfo()

Implements abstract tools.jackson.databind.BeanDescription.getObjectIdInfo.

Doc from tools.jackson.databind.BeanDescription.getObjectIdInfo.

Accessor for getting information about Object Id expected to be used for this POJO type, if any.

Annotations
@Override
getPotentialCreatorsback to summary
public PotentialCreators getPotentialCreators()

Implements abstract tools.jackson.databind.BeanDescription.getPotentialCreators.

Doc from tools.jackson.databind.BeanDescription.getPotentialCreators.

Method that is replacing earlier Creator introspection access methods.

Annotations
@Override
hasKnownClassAnnotationsback to summary
public boolean hasKnownClassAnnotations()

Implements abstract tools.jackson.databind.BeanDescription.hasKnownClassAnnotations.

Doc from tools.jackson.databind.BeanDescription.hasKnownClassAnnotations.

Method for checking whether class being described has any annotations recognized by registered annotation introspector.

Annotations
@Override
hasPropertyback to summary
public boolean hasProperty(PropertyName name)
instantiateBeanback to summary
public Object instantiateBean(boolean fixAccess)

Implements abstract tools.jackson.databind.BeanDescription.instantiateBean.

Doc from tools.jackson.databind.BeanDescription.instantiateBean.

Method called to create a "default instance" of the bean, currently only needed for obtaining default field values which may be used for suppressing serialization of fields that have "not changed".

Annotations
@Override
isFactoryMethodback to summary
protected boolean isFactoryMethod(AnnotatedMethod am)
removePropertyback to summary
public boolean removeProperty(String propName)

Method that can be used to prune unwanted properties, during construction of serializers and deserializers. Use with utmost care, if at all...

supplierback to summary
public BeanDescription.Supplier supplier()

Implements abstract tools.jackson.databind.BeanDescription.supplier.

Doc from tools.jackson.databind.BeanDescription.supplier.

Method for constructing a supplier for this bean description instance: sometimes needed when code expects supplier, not description instance.

Annotations
@Override