|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.jackson.map.BeanDescription
org.codehaus.jackson.map.introspect.BasicBeanDescription
public class BasicBeanDescription
Default BeanDescription
implementation.
Can theoretically be subclassed to customize
some aspects of property introspection.
Field Summary | |
---|---|
protected AnnotationIntrospector |
_annotationIntrospector
|
protected TypeBindings |
_bindings
We may need type bindings for the bean type. |
protected AnnotatedClass |
_classInfo
Information collected about the class introspected. |
protected MapperConfig<?> |
_config
|
Fields inherited from class org.codehaus.jackson.map.BeanDescription |
---|
_type |
Constructor Summary | |
---|---|
BasicBeanDescription(MapperConfig<?> config,
JavaType type,
AnnotatedClass ac)
|
Method Summary | |
---|---|
LinkedHashMap<String,AnnotatedField> |
_findPropertyFields(VisibilityChecker<?> vchecker,
Collection<String> ignoredProperties,
boolean forSerialization)
|
TypeBindings |
bindingsForBeanType()
Accessor 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. |
static String |
descFor(AnnotatedElement elem)
Helper method used to describe an annotated element of type Class or Method . |
AnnotatedMethod |
findAnyGetter()
Method used to locate the method of introspected class that implements JsonAnyGetter . |
AnnotatedMethod |
findAnySetter()
Method used to locate the method of introspected class that implements JsonAnySetter . |
Map<String,AnnotatedMember> |
findBackReferenceProperties()
Method for locating all back-reference properties (setters, fields) bean has |
List<String> |
findCreatorPropertyNames()
Method for getting ordered list of named Creator properties. |
Constructor<?> |
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. |
LinkedHashMap<String,AnnotatedField> |
findDeserializableFields(VisibilityChecker<?> vchecker,
Collection<String> ignoredProperties)
|
Method |
findFactoryMethod(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. |
LinkedHashMap<String,AnnotatedMethod> |
findGetters(VisibilityChecker<?> visibilityChecker,
Collection<String> ignoredProperties)
|
AnnotatedMethod |
findJsonValueMethod()
Method for locating the getter method that is annotated with JsonValue annotation,
if any. |
AnnotatedMethod |
findMethod(String name,
Class<?>[] paramTypes)
|
LinkedHashMap<String,AnnotatedField> |
findSerializableFields(VisibilityChecker<?> vchecker,
Collection<String> ignoredProperties)
|
JsonSerialize.Inclusion |
findSerializationInclusion(JsonSerialize.Inclusion defValue)
Method for determining whether null properties should be written out for a Bean of introspected type. |
LinkedHashMap<String,AnnotatedMethod> |
findSetters(VisibilityChecker<?> vchecker)
|
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) |
Annotations |
getClassAnnotations()
Method for accessing collection of annotations the bean class has. |
AnnotatedClass |
getClassInfo()
|
List<AnnotatedConstructor> |
getConstructors()
|
List<AnnotatedMethod> |
getFactoryMethods()
|
boolean |
hasKnownClassAnnotations()
Method for checking whether class being described has any annotations recognized by registered annotation introspector. |
Object |
instantiateBean(boolean fixAccess)
|
protected boolean |
isCglibGetCallbacks(AnnotatedMethod am)
This method was added to address [JACKSON-53]: need to weed out CGLib-injected "getCallbacks". |
protected boolean |
isFactoryMethod(AnnotatedMethod am)
|
protected boolean |
isGroovyMetaClassGetter(AnnotatedMethod am)
Another helper method to deal with rest of [JACKSON-103] |
protected boolean |
isGroovyMetaClassSetter(AnnotatedMethod am)
Similar to isCglibGetCallbacks(org.codehaus.jackson.map.introspect.AnnotatedMethod) , need to suppress
a cyclic reference to resolve [JACKSON-103] |
protected String |
mangleGetterName(Annotated a,
String basename)
|
static String |
manglePropertyName(String basename)
Method called to figure out name of the property, given corresponding suggested name based on a method or field name. |
protected String |
mangleSetterName(Annotated a,
String basename)
|
String |
okNameForAnyGetter(AnnotatedMethod am,
String name)
|
String |
okNameForGetter(AnnotatedMethod am,
String name)
|
String |
okNameForIsGetter(AnnotatedMethod am,
String name)
|
String |
okNameForSetter(AnnotatedMethod am)
|
Methods inherited from class org.codehaus.jackson.map.BeanDescription |
---|
getBeanClass, getType |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final MapperConfig<?> _config
protected final AnnotationIntrospector _annotationIntrospector
protected final AnnotatedClass _classInfo
protected TypeBindings _bindings
Constructor Detail |
---|
public BasicBeanDescription(MapperConfig<?> config, JavaType type, AnnotatedClass ac)
Method Detail |
---|
public boolean hasKnownClassAnnotations()
hasKnownClassAnnotations
in class BeanDescription
public Annotations getClassAnnotations()
BeanDescription
getClassAnnotations
in class BeanDescription
public TypeBindings bindingsForBeanType()
BeanDescription
bindingsForBeanType
in class BeanDescription
public AnnotatedClass getClassInfo()
public AnnotatedMethod findMethod(String name, Class<?>[] paramTypes)
public Object instantiateBean(boolean fixAccess)
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 LinkedHashMap<String,AnnotatedMethod> findGetters(VisibilityChecker<?> visibilityChecker, Collection<String> ignoredProperties)
findGetters
in class BeanDescription
visibilityChecker
- Object that determines whether
methods have enough visibility to be auto-detectable as gettersignoredProperties
- (optional, may be null) Names of properties
to ignore; getters for these properties are not to be returned.
public AnnotatedMethod findJsonValueMethod()
JsonValue
annotation,
if any. If multiple ones are found,
an error is reported by throwing IllegalArgumentException
public Constructor<?> findDefaultConstructor()
public List<AnnotatedConstructor> getConstructors()
public List<AnnotatedMethod> getFactoryMethods()
public Constructor<?> findSingleArgConstructor(Class<?>... argTypes)
argTypes
- Type(s) of the argument that we are looking forpublic Method findFactoryMethod(Class<?>... expArgTypes)
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)protected boolean isFactoryMethod(AnnotatedMethod am)
public List<String> findCreatorPropertyNames()
public LinkedHashMap<String,AnnotatedField> findSerializableFields(VisibilityChecker<?> vchecker, Collection<String> ignoredProperties)
public JsonSerialize.Inclusion findSerializationInclusion(JsonSerialize.Inclusion defValue)
public LinkedHashMap<String,AnnotatedMethod> findSetters(VisibilityChecker<?> vchecker)
findSetters
in class BeanDescription
vchecker
- (optional) Object that determines whether specific methods
have enough visibility to be considered as auto-detectable setters.
If null, auto-detection is disabled
public AnnotatedMethod findAnySetter() throws IllegalArgumentException
JsonAnySetter
. If no such method 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.
IllegalArgumentException
public AnnotatedMethod findAnyGetter() throws IllegalArgumentException
JsonAnyGetter
.
If no such method exists null is returned.
If more than one are found, an exception is thrown.
IllegalArgumentException
public Map<String,AnnotatedMember> findBackReferenceProperties()
public LinkedHashMap<String,AnnotatedField> findDeserializableFields(VisibilityChecker<?> vchecker, Collection<String> ignoredProperties)
public String okNameForAnyGetter(AnnotatedMethod am, String name)
public String okNameForGetter(AnnotatedMethod am, String name)
public String okNameForIsGetter(AnnotatedMethod am, String name)
protected String mangleGetterName(Annotated a, String basename)
protected boolean isCglibGetCallbacks(AnnotatedMethod am)
Also, see [JACKSON-177]; Hibernate may repackage cglib it uses, so we better catch that too
protected boolean isGroovyMetaClassSetter(AnnotatedMethod am)
isCglibGetCallbacks(org.codehaus.jackson.map.introspect.AnnotatedMethod)
, need to suppress
a cyclic reference to resolve [JACKSON-103]
protected boolean isGroovyMetaClassGetter(AnnotatedMethod am)
public String okNameForSetter(AnnotatedMethod am)
protected String mangleSetterName(Annotated a, String basename)
public LinkedHashMap<String,AnnotatedField> _findPropertyFields(VisibilityChecker<?> vchecker, Collection<String> ignoredProperties, boolean forSerialization)
vchecker
- (optional) Object that determines whether specific fields
have enough visibility to be considered for inclusion; if null,
auto-detection is disabledignoredProperties
- (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
public static String manglePropertyName(String basename)
basename
- Name of accessor/mutator method, not including prefix
("get"/"is"/"set")public static String descFor(AnnotatedElement elem)
Class
or Method
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |