|
||||||||||
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. |
Fields inherited from class org.codehaus.jackson.map.BeanDescription |
---|
_type |
Constructor Summary | |
---|---|
BasicBeanDescription(JavaType type,
AnnotatedClass ac,
AnnotationIntrospector ai)
|
Method Summary | |
---|---|
LinkedHashMap<String,AnnotatedField> |
_findPropertyFields(VisibilityChecker<?> vchecker,
Collection<String> ignoredProperties,
boolean forSerialization)
|
TypeBindings |
bindingsForBeanType()
|
static String |
descFor(AnnotatedElement elem)
Helper method used to describe an annotated element of type Class or Method . |
AnnotatedMethod |
findAnySetter()
Method used to locate the method of introspected class that implements JsonAnySetter . |
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) |
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 AnnotatedClass _classInfo
protected final AnnotationIntrospector _annotationIntrospector
protected TypeBindings _bindings
Constructor Detail |
---|
public BasicBeanDescription(JavaType type, AnnotatedClass ac, AnnotationIntrospector ai)
Method Detail |
---|
public AnnotatedClass getClassInfo()
public boolean hasKnownClassAnnotations()
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 TypeBindings bindingsForBeanType()
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 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 |