java.lang.Object
tools.jackson.databind.BeanDescription
tools.jackson.databind.introspect.BasicBeanDescription
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class tools.jackson.databind.BeanDescription
BeanDescription.EagerSupplier, BeanDescription.LazySupplier, BeanDescription.Supplier, BeanDescription.SupplierBase -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected JsonFormat.ValueResults of introspecting `@JsonFormat` configuration for class, if any.protected final AnnotatedClassInformation collected about the class introspected.protected final MapperConfig<?>protected Class<?>[]protected booleanprotected final AnnotationIntrospectorprotected ObjectIdInfoDetails of Object Id to include, if anyprotected final POJOPropertiesCollectorWe 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 collected for the POJO; initialized as needed.Fields inherited from class tools.jackson.databind.BeanDescription
_type -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBasicBeanDescription(MapperConfig<?> config, JavaType type, AnnotatedClass classDef) Alternate constructor used in cases where property information is not needed, only class info.protectedprotectedBasicBeanDescription(POJOPropertiesCollector coll, JavaType type, AnnotatedClass classDef) -
Method Summary
Modifier and TypeMethodDescriptionprotected List<BeanPropertyDefinition>booleanMethod used to locate the method of introspected class that implementsJsonAnyGetter.Method used to locate a mutator (settable field, or 2-argument set method) of introspected class that implementsJsonAnySetter.Method for locating all back-reference properties (setters, fields) bean hasMethod that will locate the no-arg constructor for this class, if it has one, and that constructor has not been marked as ignorable.Class<?>[]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> Method for locating accessor (readable field, or "getter" method) that hasJsonKeyannotation, if any.Method for locating accessor (readable field, or "getter" method) that hasJsonValueannotation, if any.findMethod(String name, Class<?>[] paramTypes) findProperty(PropertyName name) findPropertyInclusion(JsonInclude.Value defValue) Method for determining whether null properties should be written out for a Bean of introspected type.static BasicBeanDescriptionFactory method to use for constructing an instance to use for building deserializers.static BasicBeanDescriptionforOtherUse(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.static BasicBeanDescriptionFactory method to use for constructing an instance to use for building serializers.Method for accessing collection of annotations the bean class has.Method for accessing low-level information about Class this item describes.Helper method that will return all non-default constructors (that is, constructors that take one or more arguments) this class has.Method similar toBeanDescription.getConstructors()except will also introspectJsonCreator.Modeand filter out ones marked as not applicable and include mode (or lack thereof) for remaining constructors.Helper method that will check all static methods of the bean class that seem like factory methods eligible to be used as Creators.Method similar toBeanDescription.getFactoryMethods()but will returnJsonCreator.Modemetadata along with qualifying factory method candidates.Accessor for getting information about Object Id expected to be used for this POJO type, if any.Method that is replacing earlier Creator introspection access methods.booleanMethod for checking whether class being described has any annotations recognized by registered annotation introspector.booleanhasProperty(PropertyName name) instantiateBean(boolean fixAccess) 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 booleanbooleanremoveProperty(String propName) Method that can be used to prune unwanted properties, during construction of serializers and deserializers.supplier()Method for constructing a supplier for this bean description instance: sometimes needed when code expects supplier, not description instance.Methods inherited from class tools.jackson.databind.BeanDescription
getBeanClass, getType, isNonStaticInnerClass, isRecordType
-
Field Details
-
_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. -
_config
-
_intr
-
_classInfo
Information collected about the class introspected. -
_defaultViews
-
_defaultViewsResolved
protected boolean _defaultViewsResolved -
_properties
Properties collected for the POJO; initialized as needed. -
_objectIdInfo
Details of Object Id to include, if any -
_classFormat
Results of introspecting `@JsonFormat` configuration for class, if any.- Since:
- 3.0
-
-
Constructor Details
-
BasicBeanDescription
protected BasicBeanDescription(POJOPropertiesCollector coll, JavaType type, AnnotatedClass classDef) -
BasicBeanDescription
Alternate constructor used in cases where property information is not needed, only class info. -
BasicBeanDescription
-
-
Method Details
-
forDeserialization
Factory method to use for constructing an instance to use for building deserializers. -
forSerialization
Factory method to use for constructing an instance to use for building serializers. -
forOtherUse
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. -
_properties
-
supplier
Description copied from class:BeanDescriptionMethod for constructing a supplier for this bean description instance: sometimes needed when code expects supplier, not description instance.- Specified by:
supplierin classBeanDescription
-
removeProperty
Method that can be used to prune unwanted properties, during construction of serializers and deserializers. Use with utmost care, if at all... -
addProperty
-
hasProperty
-
findProperty
-
getClassInfo
Description copied from class:BeanDescriptionMethod for accessing low-level information about Class this item describes.- Specified by:
getClassInfoin classBeanDescription
-
getObjectIdInfo
Description copied from class:BeanDescriptionAccessor for getting information about Object Id expected to be used for this POJO type, if any.- Specified by:
getObjectIdInfoin classBeanDescription
-
findProperties
- Specified by:
findPropertiesin classBeanDescription- Returns:
- Ordered Map with logical property name as key, and matching getter method as value.
-
findJsonKeyAccessor
Description copied from class:BeanDescriptionMethod for locating accessor (readable field, or "getter" method) that hasJsonKeyannotation, if any. If multiple ones are found, an error is reported by throwingIllegalArgumentException- Overrides:
findJsonKeyAccessorin classBeanDescription
-
findJsonValueAccessor
Description copied from class:BeanDescriptionMethod for locating accessor (readable field, or "getter" method) that hasJsonValueannotation, if any. If multiple ones are found, an error is reported by throwingIllegalArgumentException- Specified by:
findJsonValueAccessorin classBeanDescription
-
getIgnoredPropertyNames
- Specified by:
getIgnoredPropertyNamesin classBeanDescription
-
hasKnownClassAnnotations
public boolean hasKnownClassAnnotations()Description copied from class:BeanDescriptionMethod for checking whether class being described has any annotations recognized by registered annotation introspector.- Specified by:
hasKnownClassAnnotationsin classBeanDescription
-
getClassAnnotations
Description copied from class:BeanDescriptionMethod for accessing collection of annotations the bean class has.- Specified by:
getClassAnnotationsin classBeanDescription
-
findDefaultConstructor
Description copied from class:BeanDescriptionMethod that will locate the no-arg constructor for this class, if it has one, and that constructor has not been marked as ignorable.- Specified by:
findDefaultConstructorin classBeanDescription
-
findAnySetterAccessor
Description copied from class:BeanDescriptionMethod used to locate a mutator (settable field, or 2-argument set method) of introspected class that implementsJsonAnySetter. 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.- Specified by:
findAnySetterAccessorin classBeanDescription- Throws:
IllegalArgumentException
-
findInjectables
- Specified by:
findInjectablesin classBeanDescription
-
getConstructors
Description copied from class:BeanDescriptionHelper method that will return all non-default constructors (that is, constructors that take one or more arguments) this class has.- Specified by:
getConstructorsin classBeanDescription
-
getConstructorsWithMode
Description copied from class:BeanDescriptionMethod similar toBeanDescription.getConstructors()except will also introspectJsonCreator.Modeand 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
- Specified by:
getConstructorsWithModein classBeanDescription
-
getPotentialCreators
Description copied from class:BeanDescriptionMethod that is replacing earlier Creator introspection access methods.- Specified by:
getPotentialCreatorsin classBeanDescription- Returns:
- Container for introspected Creator candidates, if any
-
instantiateBean
Description copied from class:BeanDescriptionMethod 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".- Specified by:
instantiateBeanin classBeanDescription- Parameters:
fixAccess- If true, method is allowed to fix access to the default constructor (to be able to call non-public constructor); if false, has to use constructor as is.- Returns:
- Instance of class represented by this descriptor, if suitable default constructor was found; null otherwise.
-
findMethod
- Specified by:
findMethodin classBeanDescription
-
findDefaultViews
Description copied from class:BeanDescriptionMethod for finding out if the POJO specifies default view(s) to use for properties, considering both per-type annotations and global default settings.- Specified by:
findDefaultViewsin classBeanDescription
-
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).- Specified by:
findPropertyInclusionin classBeanDescription
-
findAnyGetter
Method used to locate the method of introspected class that implementsJsonAnyGetter. If no such method exists null is returned. If more than one are found, an exception is thrown.- Specified by:
findAnyGetterin classBeanDescription- Throws:
IllegalArgumentException
-
findBackReferences
Description copied from class:BeanDescriptionMethod for locating all back-reference properties (setters, fields) bean has- Specified by:
findBackReferencesin classBeanDescription
-
getFactoryMethods
Description copied from class:BeanDescriptionHelper 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:- Returns type compatible with bean type (same or subtype)
- Is recognized from either explicit annotation (usually
@JsonCreatorOR naming: namesvalueOf()andfromString()are recognized but only for 1-argument factory methods, and in case offromString()argument type must further be eitherStringorCharSequence.
- Specified by:
getFactoryMethodsin classBeanDescription- Returns:
- List of static methods considered as possible Factory methods
-
getFactoryMethodsWithMode
Description copied from class:BeanDescriptionMethod similar toBeanDescription.getFactoryMethods()but will returnJsonCreator.Modemetadata along with qualifying factory method candidates.- Specified by:
getFactoryMethodsWithModein classBeanDescription
-
isFactoryMethod
-
findFactoryMethodMetadata
protected AnnotatedAndMetadata<AnnotatedMethod,JsonCreator.Mode> findFactoryMethodMetadata(AnnotatedMethod am)
-