public class BasicBeanDescription extends BeanDescription
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.
Modifier and Type | Field and Description |
---|---|
protected AnnotationIntrospector |
_annotationIntrospector |
protected AnnotatedClass |
_classInfo
Information collected about the class introspected.
|
protected MapperConfig<?> |
_config |
protected Class<?>[] |
_defaultViews |
protected boolean |
_defaultViewsResolved |
protected ObjectIdInfo |
_objectIdInfo
Details of Object Id to include, if any
|
protected 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.
|
_type
Modifier | Constructor and Description |
---|---|
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.
|
protected |
BasicBeanDescription(POJOPropertiesCollector coll) |
protected |
BasicBeanDescription(POJOPropertiesCollector coll,
JavaType type,
AnnotatedClass classDef) |
Modifier and Type | Method and Description |
---|---|
protected Converter<Object,Object> |
_createConverter(Object converterDef) |
protected PropertyName |
_findCreatorPropertyName(AnnotatedParameter param)
Deprecated.
since 2.8
|
LinkedHashMap<String,AnnotatedField> |
_findPropertyFields(Collection<String> ignoredProperties,
boolean forSerialization)
Deprecated.
Since 2.7.2, does not seem to be used?
|
protected List<BeanPropertyDefinition> |
_properties() |
boolean |
addProperty(BeanPropertyDefinition def) |
TypeBindings |
bindingsForBeanType()
Deprecated.
|
AnnotatedMember |
findAnyGetter()
Method used to locate the method of introspected class that
implements
JsonAnyGetter . |
AnnotatedMember |
findAnySetterAccessor()
Method used to locate a mutator (settable field, or 2-argument set method)
of introspected class that
implements
JsonAnySetter . |
Map<String,AnnotatedMember> |
findBackReferenceProperties()
Deprecated.
|
List<BeanPropertyDefinition> |
findBackReferences()
Method for locating all back-reference properties (setters, fields) bean has
|
String |
findClassDescription()
Accessor for possible description for the bean type, used for constructing
documentation.
|
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.
|
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 finding
Converter used for serializing instances
of this class. |
JsonFormat.Value |
findExpectedFormat(JsonFormat.Value defValue)
Method for checking what is the expected format for POJO, as
defined by defaults and possible annotations.
|
Method |
findFactoryMethod(Class<?>... expArgTypes)
Deprecated.
|
protected AnnotatedAndMetadata<AnnotatedMethod,JsonCreator.Mode> |
findFactoryMethodMetadata(AnnotatedMethod am) |
Map<Object,AnnotatedMember> |
findInjectables() |
AnnotatedMember |
findJsonKeyAccessor()
Method for locating accessor (readable field, or "getter" method)
that has
JsonKey annotation,
if any. |
AnnotatedMember |
findJsonValueAccessor()
Method for locating accessor (readable field, or "getter" method)
that has
JsonValue annotation,
if any. |
AnnotatedMethod |
findJsonValueMethod()
Deprecated.
|
AnnotatedMethod |
findMethod(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.Value |
findPOJOBuilderConfig()
Method for finding configuration for POJO Builder class.
|
List<BeanPropertyDefinition> |
findProperties() |
BeanPropertyDefinition |
findProperty(PropertyName name) |
JsonInclude.Value |
findPropertyInclusion(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 finding
Converter used for serializing instances
of this class. |
Constructor<?> |
findSingleArgConstructor(Class<?>... argTypes)
Deprecated.
|
static BasicBeanDescription |
forDeserialization(POJOPropertiesCollector coll)
Factory method to use for constructing an instance to use for building
deserializers.
|
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.
|
static BasicBeanDescription |
forSerialization(POJOPropertiesCollector coll)
Factory method to use for constructing an instance to use for building
serializers.
|
Annotations |
getClassAnnotations()
Method for accessing collection of annotations the bean
class has.
|
AnnotatedClass |
getClassInfo()
Method for accessing low-level information about Class this
item describes.
|
List<AnnotatedConstructor> |
getConstructors()
Helper method that will return all non-default constructors (that is,
constructors that take one or more arguments) this class has.
|
List<AnnotatedAndMetadata<AnnotatedConstructor,JsonCreator.Mode>> |
getConstructorsWithMode()
Method similar to
BeanDescription.getConstructors() except will also introspect
JsonCreator.Mode and filter out ones marked as not applicable and
include mode (or lack thereof) for remaining constructors. |
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.
|
List<AnnotatedAndMetadata<AnnotatedMethod,JsonCreator.Mode>> |
getFactoryMethodsWithMode()
Method similar to
BeanDescription.getFactoryMethods() but will return JsonCreator.Mode
metadata along with qualifying factory method candidates. |
Set<String> |
getIgnoredPropertyNames() |
ObjectIdInfo |
getObjectIdInfo()
Accessor for getting information about Object Id expected to
be used for this POJO type, if any.
|
boolean |
hasKnownClassAnnotations()
Method for checking whether class being described has any
annotations recognized by registered annotation introspector.
|
boolean |
hasProperty(PropertyName name) |
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".
|
protected boolean |
isFactoryMethod(AnnotatedMethod am) |
boolean |
removeProperty(String propName)
Method that can be used to prune unwanted properties, during
construction of serializers and deserializers.
|
JavaType |
resolveType(Type jdkType)
Deprecated.
|
findAnySetter, findAnySetterField, getBeanClass, getType, isNonStaticInnerClass
protected final POJOPropertiesCollector _propCollector
protected final MapperConfig<?> _config
protected final AnnotationIntrospector _annotationIntrospector
protected final AnnotatedClass _classInfo
protected Class<?>[] _defaultViews
protected boolean _defaultViewsResolved
protected List<BeanPropertyDefinition> _properties
protected ObjectIdInfo _objectIdInfo
protected BasicBeanDescription(POJOPropertiesCollector coll, JavaType type, AnnotatedClass classDef)
protected BasicBeanDescription(MapperConfig<?> config, JavaType type, AnnotatedClass classDef, List<BeanPropertyDefinition> props)
protected BasicBeanDescription(POJOPropertiesCollector coll)
public static BasicBeanDescription forDeserialization(POJOPropertiesCollector coll)
public static BasicBeanDescription forSerialization(POJOPropertiesCollector coll)
public static BasicBeanDescription forOtherUse(MapperConfig<?> config, JavaType type, AnnotatedClass ac)
protected List<BeanPropertyDefinition> _properties()
public boolean removeProperty(String propName)
public boolean addProperty(BeanPropertyDefinition def)
public boolean hasProperty(PropertyName name)
public BeanPropertyDefinition findProperty(PropertyName name)
public AnnotatedClass getClassInfo()
BeanDescription
getClassInfo
in class BeanDescription
public ObjectIdInfo getObjectIdInfo()
BeanDescription
getObjectIdInfo
in class BeanDescription
public List<BeanPropertyDefinition> findProperties()
findProperties
in class BeanDescription
public AnnotatedMember findJsonKeyAccessor()
BeanDescription
JsonKey
annotation,
if any. If multiple ones are found,
an error is reported by throwing IllegalArgumentException
findJsonKeyAccessor
in class BeanDescription
@Deprecated public AnnotatedMethod findJsonValueMethod()
findJsonValueMethod
in class BeanDescription
public AnnotatedMember findJsonValueAccessor()
BeanDescription
JsonValue
annotation,
if any. If multiple ones are found,
an error is reported by throwing IllegalArgumentException
findJsonValueAccessor
in class BeanDescription
public Set<String> getIgnoredPropertyNames()
getIgnoredPropertyNames
in class BeanDescription
public boolean hasKnownClassAnnotations()
BeanDescription
hasKnownClassAnnotations
in class BeanDescription
public Annotations getClassAnnotations()
BeanDescription
getClassAnnotations
in class BeanDescription
@Deprecated public TypeBindings bindingsForBeanType()
BeanDescription
bindingsForBeanType
in class BeanDescription
@Deprecated public JavaType resolveType(Type jdkType)
BeanDescription
resolveType
in class BeanDescription
public AnnotatedConstructor findDefaultConstructor()
BeanDescription
findDefaultConstructor
in class BeanDescription
public AnnotatedMember findAnySetterAccessor() throws IllegalArgumentException
BeanDescription
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.findAnySetterAccessor
in class BeanDescription
IllegalArgumentException
public Map<Object,AnnotatedMember> findInjectables()
findInjectables
in class BeanDescription
public List<AnnotatedConstructor> getConstructors()
BeanDescription
getConstructors
in class BeanDescription
public List<AnnotatedAndMetadata<AnnotatedConstructor,JsonCreator.Mode>> getConstructorsWithMode()
BeanDescription
BeanDescription.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
getConstructorsWithMode
in class BeanDescription
public Object instantiateBean(boolean fixAccess)
BeanDescription
instantiateBean
in class BeanDescription
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.public AnnotatedMethod findMethod(String name, Class<?>[] paramTypes)
findMethod
in class BeanDescription
public JsonFormat.Value findExpectedFormat(JsonFormat.Value defValue)
BeanDescription
findExpectedFormat
in class BeanDescription
public Class<?>[] findDefaultViews()
BeanDescription
findDefaultViews
in class BeanDescription
public Converter<Object,Object> findSerializationConverter()
BeanDescription
Converter
used for serializing instances
of this class.findSerializationConverter
in class BeanDescription
public JsonInclude.Value findPropertyInclusion(JsonInclude.Value defValue)
findPropertyInclusion
in class BeanDescription
public AnnotatedMember findAnyGetter() throws IllegalArgumentException
JsonAnyGetter
.
If no such method exists null is returned.
If more than one are found, an exception is thrown.findAnyGetter
in class BeanDescription
IllegalArgumentException
public List<BeanPropertyDefinition> findBackReferences()
BeanDescription
findBackReferences
in class BeanDescription
@Deprecated public Map<String,AnnotatedMember> findBackReferenceProperties()
BeanDescription
findBackReferenceProperties
in class BeanDescription
public List<AnnotatedMethod> getFactoryMethods()
BeanDescription
@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
.
getFactoryMethods
in class BeanDescription
public List<AnnotatedAndMetadata<AnnotatedMethod,JsonCreator.Mode>> getFactoryMethodsWithMode()
BeanDescription
BeanDescription.getFactoryMethods()
but will return JsonCreator.Mode
metadata along with qualifying factory method candidates.getFactoryMethodsWithMode
in class BeanDescription
@Deprecated public Constructor<?> findSingleArgConstructor(Class<?>... argTypes)
findSingleArgConstructor
in class BeanDescription
@Deprecated public Method findFactoryMethod(Class<?>... expArgTypes)
findFactoryMethod
in class BeanDescription
protected boolean isFactoryMethod(AnnotatedMethod am)
protected AnnotatedAndMetadata<AnnotatedMethod,JsonCreator.Mode> findFactoryMethodMetadata(AnnotatedMethod am)
@Deprecated protected PropertyName _findCreatorPropertyName(AnnotatedParameter param)
public Class<?> findPOJOBuilder()
BeanDescription
findPOJOBuilder
in class BeanDescription
public JsonPOJOBuilder.Value findPOJOBuilderConfig()
BeanDescription
findPOJOBuilderConfig
in class BeanDescription
public Converter<Object,Object> findDeserializationConverter()
BeanDescription
Converter
used for serializing instances
of this class.findDeserializationConverter
in class BeanDescription
public String findClassDescription()
BeanDescription
findClassDescription
in class BeanDescription
@Deprecated public LinkedHashMap<String,AnnotatedField> _findPropertyFields(Collection<String> ignoredProperties, boolean forSerialization)
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, deserializableCopyright © 2008–2021 FasterXML. All rights reserved.