Package com.fasterxml.jackson.databind
Class BeanDescription
- java.lang.Object
-
- com.fasterxml.jackson.databind.BeanDescription
-
- Direct Known Subclasses:
BasicBeanDescription
public abstract class BeanDescription extends java.lang.Object
Basic container for information gathered byClassIntrospector
to help in constructing serializers and deserializers. Note that the one implementation type isBasicBeanDescription
, meaning that it is safe to upcast to that type.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
BeanDescription(JavaType type)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract AnnotatedMember
findAnyGetter()
abstract AnnotatedMember
findAnySetterAccessor()
Method used to locate a mutator (settable field, or 2-argument set method) of introspected class that implementsJsonAnySetter
.abstract java.util.List<BeanPropertyDefinition>
findBackReferences()
Method for locating all back-reference properties (setters, fields) bean hasjava.lang.String
findClassDescription()
Accessor for possible description for the bean type, used for constructing documentation.abstract AnnotatedConstructor
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.abstract java.lang.Class<?>[]
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.abstract Converter<java.lang.Object,java.lang.Object>
findDeserializationConverter()
Method for findingConverter
used for serializing instances of this class.abstract com.fasterxml.jackson.annotation.JsonFormat.Value
findExpectedFormat()
Method for checking what is the expected format for POJO, as defined by defaults and possible annotations.com.fasterxml.jackson.annotation.JsonFormat.Value
findExpectedFormat(com.fasterxml.jackson.annotation.JsonFormat.Value defValue)
Deprecated.Since 2.17 usefindExpectedFormat()
abstract java.util.Map<java.lang.Object,AnnotatedMember>
findInjectables()
AnnotatedMember
findJsonKeyAccessor()
Method for locating accessor (readable field, or "getter" method) that hasJsonKey
annotation, if any.abstract AnnotatedMember
findJsonValueAccessor()
Method for locating accessor (readable field, or "getter" method) that hasJsonValue
annotation, if any.abstract AnnotatedMethod
findMethod(java.lang.String name, java.lang.Class<?>[] paramTypes)
abstract java.lang.Class<?>
findPOJOBuilder()
Method for checking if the POJO type has annotations to indicate that a builder is to be used for instantiating instances and handling data binding, instead of standard bean deserializer.abstract JsonPOJOBuilder.Value
findPOJOBuilderConfig()
Method for finding configuration for POJO Builder class.abstract java.util.List<BeanPropertyDefinition>
findProperties()
abstract com.fasterxml.jackson.annotation.JsonInclude.Value
findPropertyInclusion(com.fasterxml.jackson.annotation.JsonInclude.Value defValue)
Method for finding annotation-indicated inclusion definition (if any); possibly overriding given default value.abstract Converter<java.lang.Object,java.lang.Object>
findSerializationConverter()
Method for findingConverter
used for serializing instances of this class.java.lang.Class<?>
getBeanClass()
abstract Annotations
getClassAnnotations()
Method for accessing collection of annotations the bean class has.abstract AnnotatedClass
getClassInfo()
Method for accessing low-level information about Class this item describes.abstract java.util.List<AnnotatedConstructor>
getConstructors()
Helper method that will return all non-default constructors (that is, constructors that take one or more arguments) this class has.abstract java.util.List<AnnotatedAndMetadata<AnnotatedConstructor,com.fasterxml.jackson.annotation.JsonCreator.Mode>>
getConstructorsWithMode()
Method similar togetConstructors()
except will also introspectJsonCreator.Mode
and filter out ones marked as not applicable and include mode (or lack thereof) for remaining constructors.abstract java.util.List<AnnotatedMethod>
getFactoryMethods()
Helper method that will check all static methods of the bean class that seem like factory methods eligible to be used as Creators.abstract java.util.List<AnnotatedAndMetadata<AnnotatedMethod,com.fasterxml.jackson.annotation.JsonCreator.Mode>>
getFactoryMethodsWithMode()
Method similar togetFactoryMethods()
but will returnJsonCreator.Mode
metadata along with qualifying factory method candidates.abstract java.util.Set<java.lang.String>
getIgnoredPropertyNames()
abstract ObjectIdInfo
getObjectIdInfo()
Accessor for getting information about Object Id expected to be used for this POJO type, if any.abstract PotentialCreators
getPotentialCreators()
Method that is replacing earlier Creator introspection access methods.JavaType
getType()
Method for accessing declared type of bean being introspected, including full generic type information (from declaration)abstract boolean
hasKnownClassAnnotations()
Method for checking whether class being described has any annotations recognized by registered annotation introspector.abstract java.lang.Object
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".boolean
isNonStaticInnerClass()
boolean
isRecordType()
-
-
-
Field Detail
-
_type
protected final JavaType _type
Bean type information, including raw class and possible generics information
-
-
Constructor Detail
-
BeanDescription
protected BeanDescription(JavaType type)
-
-
Method Detail
-
getType
public JavaType getType()
Method for accessing declared type of bean being introspected, including full generic type information (from declaration)
-
getBeanClass
public java.lang.Class<?> getBeanClass()
-
isRecordType
public boolean isRecordType()
- Since:
- 2.15
-
isNonStaticInnerClass
public boolean isNonStaticInnerClass()
- Since:
- 2.9
-
getClassInfo
public abstract AnnotatedClass getClassInfo()
Method for accessing low-level information about Class this item describes.
-
getObjectIdInfo
public abstract ObjectIdInfo getObjectIdInfo()
Accessor for getting information about Object Id expected to be used for this POJO type, if any.
-
hasKnownClassAnnotations
public abstract boolean hasKnownClassAnnotations()
Method for checking whether class being described has any annotations recognized by registered annotation introspector.
-
getClassAnnotations
public abstract Annotations getClassAnnotations()
Method for accessing collection of annotations the bean class has.
-
findProperties
public abstract java.util.List<BeanPropertyDefinition> findProperties()
- Returns:
- Ordered Map with logical property name as key, and matching getter method as value.
-
getIgnoredPropertyNames
public abstract java.util.Set<java.lang.String> getIgnoredPropertyNames()
-
findBackReferences
public abstract java.util.List<BeanPropertyDefinition> findBackReferences()
Method for locating all back-reference properties (setters, fields) bean has- Since:
- 2.9
-
getConstructors
public abstract java.util.List<AnnotatedConstructor> getConstructors()
Helper method that will return all non-default constructors (that is, constructors that take one or more arguments) this class has.
-
getConstructorsWithMode
public abstract java.util.List<AnnotatedAndMetadata<AnnotatedConstructor,com.fasterxml.jackson.annotation.JsonCreator.Mode>> getConstructorsWithMode()
Method similar togetConstructors()
except will also introspectJsonCreator.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
- Since:
- 2.13
-
getFactoryMethods
public abstract java.util.List<AnnotatedMethod> 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:- Returns type compatible with bean type (same or subtype)
- Is recognized from either explicit annotation (usually
@JsonCreator
OR naming: namesvalueOf()
andfromString()
are recognized but only for 1-argument factory methods, and in case offromString()
argument type must further be eitherString
orCharSequence
.
- Returns:
- List of static methods considered as possible Factory methods
-
getFactoryMethodsWithMode
public abstract java.util.List<AnnotatedAndMetadata<AnnotatedMethod,com.fasterxml.jackson.annotation.JsonCreator.Mode>> getFactoryMethodsWithMode()
Method similar togetFactoryMethods()
but will returnJsonCreator.Mode
metadata along with qualifying factory method candidates.- Since:
- 2.13
-
findDefaultConstructor
public abstract AnnotatedConstructor 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.
-
getPotentialCreators
public abstract PotentialCreators getPotentialCreators()
Method that is replacing earlier Creator introspection access methods.- Returns:
- Container for introspected Creator candidates, if any
- Since:
- 2.18
-
findJsonKeyAccessor
public AnnotatedMember findJsonKeyAccessor()
Method for locating accessor (readable field, or "getter" method) that hasJsonKey
annotation, if any. If multiple ones are found, an error is reported by throwingIllegalArgumentException
- Since:
- 2.12
-
findJsonValueAccessor
public abstract AnnotatedMember findJsonValueAccessor()
Method for locating accessor (readable field, or "getter" method) that hasJsonValue
annotation, if any. If multiple ones are found, an error is reported by throwingIllegalArgumentException
- Since:
- 2.9
-
findAnyGetter
public abstract AnnotatedMember findAnyGetter()
-
findAnySetterAccessor
public abstract AnnotatedMember findAnySetterAccessor()
Method 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.- Since:
- 2.9
-
findMethod
public abstract AnnotatedMethod findMethod(java.lang.String name, java.lang.Class<?>[] paramTypes)
-
findPropertyInclusion
public abstract com.fasterxml.jackson.annotation.JsonInclude.Value findPropertyInclusion(com.fasterxml.jackson.annotation.JsonInclude.Value defValue)
Method for finding annotation-indicated inclusion definition (if any); possibly overriding given default value.NOTE: does NOT use global inclusion default settings as the base, unless passed as `defValue`.
- Since:
- 2.7
-
findExpectedFormat
public abstract com.fasterxml.jackson.annotation.JsonFormat.Value findExpectedFormat()
Method for checking what is the expected format for POJO, as defined by defaults and possible annotations. Note that this may be further refined by per-property annotations.- Since:
- 2.17
-
findExpectedFormat
@Deprecated public com.fasterxml.jackson.annotation.JsonFormat.Value findExpectedFormat(com.fasterxml.jackson.annotation.JsonFormat.Value defValue)
Deprecated.Since 2.17 usefindExpectedFormat()
- Since:
- 2.1
-
findSerializationConverter
public abstract Converter<java.lang.Object,java.lang.Object> findSerializationConverter()
Method for findingConverter
used for serializing instances of this class.- Since:
- 2.2
-
findDeserializationConverter
public abstract Converter<java.lang.Object,java.lang.Object> findDeserializationConverter()
Method for findingConverter
used for serializing instances of this class.- Since:
- 2.2
-
findClassDescription
public java.lang.String findClassDescription()
Accessor for possible description for the bean type, used for constructing documentation.- Since:
- 2.7
-
findInjectables
public abstract java.util.Map<java.lang.Object,AnnotatedMember> findInjectables()
-
findPOJOBuilder
public abstract java.lang.Class<?> findPOJOBuilder()
Method for checking if the POJO type has annotations to indicate that a builder is to be used for instantiating instances and handling data binding, instead of standard bean deserializer.
-
findPOJOBuilderConfig
public abstract JsonPOJOBuilder.Value findPOJOBuilderConfig()
Method for finding configuration for POJO Builder class.
-
instantiateBean
public abstract java.lang.Object 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".- 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.
-
findDefaultViews
public abstract java.lang.Class<?>[] 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.- Since:
- 2.9
-
-