Class BasicBeanDescription
- java.lang.Object
-
- com.fasterxml.jackson.databind.BeanDescription
-
- com.fasterxml.jackson.databind.introspect.BasicBeanDescription
-
public class BasicBeanDescription extends BeanDescription
DefaultBeanDescriptionimplementation 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
Fields Modifier and Type Field Description protected AnnotationIntrospector_annotationIntrospectorprotected AnnotatedClass_classInfoInformation collected about the class introspected.protected MapperConfig<?>_configprotected Class<?>[]_defaultViewsprotected boolean_defaultViewsResolvedprotected ObjectIdInfo_objectIdInfoDetails of Object Id to include, if anyprotected POJOPropertiesCollector_propCollectorWe 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>_propertiesProperties collected for the POJO; initialized as needed.-
Fields inherited from class com.fasterxml.jackson.databind.BeanDescription
_type
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedBasicBeanDescription(MapperConfig<?> config, JavaType type, AnnotatedClass classDef, List<BeanPropertyDefinition> props)Alternate constructor used in cases where property information is not needed, only class info.protectedBasicBeanDescription(POJOPropertiesCollector coll)protectedBasicBeanDescription(POJOPropertiesCollector coll, JavaType type, AnnotatedClass classDef)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected Converter<Object,Object>_createConverter(Object converterDef)protected PropertyName_findCreatorPropertyName(AnnotatedParameter param)Deprecated.since 2.8LinkedHashMap<String,AnnotatedField>_findPropertyFields(Collection<String> ignoredProperties, boolean forSerialization)Deprecated.Since 2.7.2, does not seem to be used?protected List<BeanPropertyDefinition>_properties()booleanaddProperty(BeanPropertyDefinition def)TypeBindingsbindingsForBeanType()Deprecated.AnnotatedMemberfindAnyGetter()Method used to locate the method of introspected class that implementsJsonAnyGetter.AnnotatedMemberfindAnySetterAccessor()Method used to locate a mutator (settable field, or 2-argument set method) of introspected class that implementsJsonAnySetter.Map<String,AnnotatedMember>findBackReferenceProperties()Deprecated.List<BeanPropertyDefinition>findBackReferences()Method for locating all back-reference properties (setters, fields) bean hasStringfindClassDescription()Accessor for possible description for the bean type, used for constructing documentation.AnnotatedConstructorfindDefaultConstructor()Method that will locate the no-arg constructor for this class, if it has one, and that constructor has not been marked as ignorable.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.Converter<Object,Object>findDeserializationConverter()Method for findingConverterused for serializing instances of this class.com.fasterxml.jackson.annotation.JsonFormat.ValuefindExpectedFormat(com.fasterxml.jackson.annotation.JsonFormat.Value defValue)Method for checking what is the expected format for POJO, as defined by defaults and possible annotations.MethodfindFactoryMethod(Class<?>... expArgTypes)Method that can be called to find if introspected class declares a static "valueOf" factory method that returns an instance of introspected type, given one of acceptable types.Map<Object,AnnotatedMember>findInjectables()AnnotatedMemberfindJsonValueAccessor()Method for locating accessor (readable field, or "getter" method) that hasJsonValueannotation, if any.AnnotatedMethodfindJsonValueMethod()Deprecated.AnnotatedMethodfindMethod(String name, Class<?>[] paramTypes)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.JsonPOJOBuilder.ValuefindPOJOBuilderConfig()Method for finding configuration for POJO Builder class.List<BeanPropertyDefinition>findProperties()BeanPropertyDefinitionfindProperty(PropertyName name)com.fasterxml.jackson.annotation.JsonInclude.ValuefindPropertyInclusion(com.fasterxml.jackson.annotation.JsonInclude.Value defValue)Method for determining whether null properties should be written out for a Bean of introspected type.Converter<Object,Object>findSerializationConverter()Method for findingConverterused for serializing instances of this class.Constructor<?>findSingleArgConstructor(Class<?>... argTypes)Method that can be called to locate a single-arg constructor that takes specified exact type (will not accept supertype constructors)static BasicBeanDescriptionforDeserialization(POJOPropertiesCollector coll)Factory 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 BasicBeanDescriptionforSerialization(POJOPropertiesCollector coll)Factory method to use for constructing an instance to use for building serializers.AnnotationsgetClassAnnotations()Method for accessing collection of annotations the bean class has.AnnotatedClassgetClassInfo()Method for accessing low-level information about Class this item describes.List<AnnotatedConstructor>getConstructors()List<AnnotatedMethod>getFactoryMethods()Set<String>getIgnoredPropertyNames()ObjectIdInfogetObjectIdInfo()Accessor for getting information about Object Id expected to be used for this POJO type, if any.booleanhasKnownClassAnnotations()Method for checking whether class being described has any annotations recognized by registered annotation introspector.booleanhasProperty(PropertyName name)ObjectinstantiateBean(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 booleanisFactoryMethod(AnnotatedMethod am)booleanremoveProperty(String propName)Method that can be used to prune unwanted properties, during construction of serializers and deserializers.JavaTyperesolveType(Type jdkType)Deprecated.-
Methods inherited from class com.fasterxml.jackson.databind.BeanDescription
findAnySetter, findAnySetterField, getBeanClass, getType, isNonStaticInnerClass
-
-
-
-
Field Detail
-
_propCollector
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.
-
_config
protected final MapperConfig<?> _config
-
_annotationIntrospector
protected final AnnotationIntrospector _annotationIntrospector
-
_classInfo
protected final AnnotatedClass _classInfo
Information collected about the class introspected.
-
_defaultViews
protected Class<?>[] _defaultViews
- Since:
- 2.9
-
_defaultViewsResolved
protected boolean _defaultViewsResolved
- Since:
- 2.9
-
_properties
protected List<BeanPropertyDefinition> _properties
Properties collected for the POJO; initialized as needed.
-
_objectIdInfo
protected ObjectIdInfo _objectIdInfo
Details of Object Id to include, if any
-
-
Constructor Detail
-
BasicBeanDescription
protected BasicBeanDescription(POJOPropertiesCollector coll, JavaType type, AnnotatedClass classDef)
-
BasicBeanDescription
protected BasicBeanDescription(MapperConfig<?> config, JavaType type, AnnotatedClass classDef, List<BeanPropertyDefinition> props)
Alternate constructor used in cases where property information is not needed, only class info.
-
BasicBeanDescription
protected BasicBeanDescription(POJOPropertiesCollector coll)
-
-
Method Detail
-
forDeserialization
public static BasicBeanDescription forDeserialization(POJOPropertiesCollector coll)
Factory method to use for constructing an instance to use for building deserializers.
-
forSerialization
public static BasicBeanDescription forSerialization(POJOPropertiesCollector coll)
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
protected List<BeanPropertyDefinition> _properties()
-
removeProperty
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...- Since:
- 2.1
-
addProperty
public boolean addProperty(BeanPropertyDefinition def)
-
hasProperty
public boolean hasProperty(PropertyName name)
- Since:
- 2.6
-
findProperty
public BeanPropertyDefinition findProperty(PropertyName name)
- Since:
- 2.6
-
getClassInfo
public AnnotatedClass getClassInfo()
Description copied from class:BeanDescriptionMethod for accessing low-level information about Class this item describes.- Specified by:
getClassInfoin classBeanDescription
-
getObjectIdInfo
public ObjectIdInfo 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
public List<BeanPropertyDefinition> findProperties()
- Specified by:
findPropertiesin classBeanDescription- Returns:
- Ordered Map with logical property name as key, and matching getter method as value.
-
findJsonValueMethod
@Deprecated public AnnotatedMethod findJsonValueMethod()
Deprecated.- Specified by:
findJsonValueMethodin classBeanDescription
-
findJsonValueAccessor
public AnnotatedMember 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
public Set<String> 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
public Annotations getClassAnnotations()
Description copied from class:BeanDescriptionMethod for accessing collection of annotations the bean class has.- Specified by:
getClassAnnotationsin classBeanDescription
-
bindingsForBeanType
@Deprecated public TypeBindings bindingsForBeanType()
Deprecated.Description copied from class:BeanDescriptionAccessor for type bindings that may be needed to fully resolve types of member object, such as return and argument types of methods and constructors, and types of fields.- Specified by:
bindingsForBeanTypein classBeanDescription
-
resolveType
@Deprecated public JavaType resolveType(Type jdkType)
Deprecated.Description copied from class:BeanDescriptionMethod for resolving given JDK type, using this bean as the generic type resolution context.- Specified by:
resolveTypein classBeanDescription
-
findDefaultConstructor
public AnnotatedConstructor 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
public AnnotatedMember findAnySetterAccessor() throws IllegalArgumentException
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
public Map<Object,AnnotatedMember> findInjectables()
- Specified by:
findInjectablesin classBeanDescription
-
getConstructors
public List<AnnotatedConstructor> getConstructors()
- Specified by:
getConstructorsin classBeanDescription
-
instantiateBean
public Object instantiateBean(boolean fixAccess)
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
public AnnotatedMethod findMethod(String name, Class<?>[] paramTypes)
- Specified by:
findMethodin classBeanDescription
-
findExpectedFormat
public com.fasterxml.jackson.annotation.JsonFormat.Value findExpectedFormat(com.fasterxml.jackson.annotation.JsonFormat.Value defValue)
Description copied from class:BeanDescriptionMethod 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.- Specified by:
findExpectedFormatin classBeanDescription
-
findDefaultViews
public Class<?>[] 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
-
findSerializationConverter
public Converter<Object,Object> findSerializationConverter()
Description copied from class:BeanDescriptionMethod for findingConverterused for serializing instances of this class.- Specified by:
findSerializationConverterin classBeanDescription
-
findPropertyInclusion
public com.fasterxml.jackson.annotation.JsonInclude.Value findPropertyInclusion(com.fasterxml.jackson.annotation.JsonInclude.Value defValue)
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
public AnnotatedMember findAnyGetter() throws IllegalArgumentException
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
public List<BeanPropertyDefinition> findBackReferences()
Description copied from class:BeanDescriptionMethod for locating all back-reference properties (setters, fields) bean has- Specified by:
findBackReferencesin classBeanDescription
-
findBackReferenceProperties
@Deprecated public Map<String,AnnotatedMember> findBackReferenceProperties()
Deprecated.Description copied from class:BeanDescriptionMethod for locating all back-reference properties (setters, fields) bean has- Specified by:
findBackReferencePropertiesin classBeanDescription
-
getFactoryMethods
public List<AnnotatedMethod> getFactoryMethods()
- Specified by:
getFactoryMethodsin classBeanDescription
-
findSingleArgConstructor
public Constructor<?> findSingleArgConstructor(Class<?>... argTypes)
Description copied from class:BeanDescriptionMethod that can be called to locate a single-arg constructor that takes specified exact type (will not accept supertype constructors)- Specified by:
findSingleArgConstructorin classBeanDescription- Parameters:
argTypes- Type(s) of the argument that we are looking for
-
findFactoryMethod
public Method findFactoryMethod(Class<?>... expArgTypes)
Description copied from class:BeanDescriptionMethod that can be called to find if introspected class declares a static "valueOf" factory method that returns an instance of introspected type, given one of acceptable types.- Specified by:
findFactoryMethodin classBeanDescription- Parameters:
expArgTypes- Types that the matching single argument factory method can take: will also accept super types of these types (ie. arg just has to be assignable from expArgType)
-
isFactoryMethod
protected boolean isFactoryMethod(AnnotatedMethod am)
-
_findCreatorPropertyName
@Deprecated protected PropertyName _findCreatorPropertyName(AnnotatedParameter param)
Deprecated.since 2.8
-
findPOJOBuilder
public Class<?> findPOJOBuilder()
Description copied from class:BeanDescriptionMethod 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.- Specified by:
findPOJOBuilderin classBeanDescription
-
findPOJOBuilderConfig
public JsonPOJOBuilder.Value findPOJOBuilderConfig()
Description copied from class:BeanDescriptionMethod for finding configuration for POJO Builder class.- Specified by:
findPOJOBuilderConfigin classBeanDescription
-
findDeserializationConverter
public Converter<Object,Object> findDeserializationConverter()
Description copied from class:BeanDescriptionMethod for findingConverterused for serializing instances of this class.- Specified by:
findDeserializationConverterin classBeanDescription
-
findClassDescription
public String findClassDescription()
Description copied from class:BeanDescriptionAccessor for possible description for the bean type, used for constructing documentation.- Overrides:
findClassDescriptionin classBeanDescription
-
_findPropertyFields
@Deprecated public LinkedHashMap<String,AnnotatedField> _findPropertyFields(Collection<String> ignoredProperties, boolean forSerialization)
Deprecated.Since 2.7.2, does not seem to be used?- Parameters:
ignoredProperties- (optional) names of properties to ignore; any fields that would be recognized as one of these properties is ignored.forSerialization- If true, will collect serializable property fields; if false, deserializable- Returns:
- Ordered Map with logical property name as key, and matching field as value.
-
-