public class ClassDescriptor
extends java.lang.Object
Descriptors are 'lazy': various internal caches are created only on request.
Throughout this class, public members are defined as members defined with "public" keyword and declared in a public type. Public members declared by a non-public class is considered non-public because access to it from outside is prohibited by the java access control anyway.
Public members defined in public classes are always preferred even when we allow private/protected members and types to be visible. So if a non-public subtype and a public super type both have a field with the same name, the field in the public super type is always used.
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
accessibleOnly |
protected jodd.introspector.Ctors |
allCtors |
protected jodd.introspector.Fields |
allFields |
protected jodd.introspector.Methods |
allMethods |
protected jodd.introspector.Properties |
allProperties |
protected jodd.introspector.Ctors |
publicCtors |
protected jodd.introspector.Fields |
publicFields |
protected jodd.introspector.Methods |
publicMethods |
protected jodd.introspector.Properties |
publicProperties |
protected java.lang.Class |
type |
protected int |
usageCount |
| Constructor and Description |
|---|
ClassDescriptor(java.lang.Class type,
boolean accessibleOnly) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String[] |
getAllBeanGetterNames(boolean declared)
Returns all bean getters names.
|
java.lang.reflect.Method[] |
getAllBeanGetters(boolean declared)
Returns all bean getters.
|
java.lang.String[] |
getAllBeanSetterNames(boolean declared)
Returns an array of all bean setters names.
|
java.lang.reflect.Method[] |
getAllBeanSetters(boolean declared)
Returns an array of all bean setters.
|
java.lang.reflect.Constructor[] |
getAllCtors(boolean declared)
Returns an array of all ctors.
|
java.lang.reflect.Field[] |
getAllFields(boolean declared)
Returns an array of all fields.
|
java.lang.reflect.Method[] |
getAllMethods(boolean declared)
Returns an array of all methods.
|
java.lang.reflect.Method[] |
getAllMethods(java.lang.String name,
boolean declared)
Returns an array of all methods with the same name.
|
java.lang.reflect.Method |
getBeanGetter(java.lang.String name,
boolean declared)
Returns bean getter identified by name.
|
MethodDescriptor |
getBeanGetterMethodDescriptor(java.lang.String name,
boolean declared)
Returns
MethodDescriptor for bean setter identified by name. |
java.lang.reflect.Method |
getBeanSetter(java.lang.String name,
boolean declared)
Returns bean setter identified by name.
|
MethodDescriptor |
getBeanSetterMethodDescriptor(java.lang.String name,
boolean declared)
Returns bean setter
MethodDescriptor identified by name. |
java.lang.reflect.Constructor |
getCtor(java.lang.Class[] args,
boolean declared)
Returns the constructor identified by arguments or
null if not found. |
int |
getCtorsCount(boolean declared)
Returns the total number of constructors.
|
java.lang.reflect.Constructor |
getDefaultCtor()
Returns the public default ctor or
null if not found. |
java.lang.reflect.Constructor |
getDefaultCtor(boolean declared)
Returns the default ctor or
null if not found. |
java.lang.reflect.Field |
getField(java.lang.String name,
boolean declared)
Returns the field identified by name or
null if not found. |
FieldDescriptor |
getFieldDescriptor(java.lang.String name,
boolean declared)
Returns field descriptor.
|
int |
getFieldsCount(boolean declared)
Returns the total number of fields.
|
java.lang.reflect.Method |
getMethod(java.lang.String name,
boolean declared)
Returns the method identified by name or
null if not found. |
java.lang.reflect.Method |
getMethod(java.lang.String name,
java.lang.Class[] params,
boolean declared)
Returns the method identified by name and parameters.
|
MethodDescriptor |
getMethodDescriptor(java.lang.String name,
java.lang.Class[] params,
boolean declared)
Returns
method descriptor identified by name and parameters. |
int |
getMethodsCount(boolean declared)
Returns methods count.
|
java.lang.Class |
getType()
Get the class object that this descriptor describes.
|
int |
getUsageCount()
Returns number of class description usages.
|
protected void |
increaseUsageCount()
Increases descriptor usage.
|
protected void |
inspectCtors()
Inspect class ctors and create ctors cache.
|
protected void |
inspectFields()
Inspect class fields and create fields cache.
|
protected void |
inspectMethods()
Inspect methods and create methods cache.
|
protected void |
inspectProperties()
Inspect methods and create properties cache.
|
boolean |
isArray()
Returns
true if class is an array. |
boolean |
isCollection()
Returns
true if type is a collection. |
boolean |
isList()
Returns
true if class is a List. |
boolean |
isMap()
Returns
true if class is a Map. |
boolean |
isSet()
Returns
true if type is a Set. |
protected final java.lang.Class type
protected final boolean accessibleOnly
protected int usageCount
protected jodd.introspector.Fields publicFields
protected jodd.introspector.Fields allFields
protected jodd.introspector.Methods publicMethods
protected jodd.introspector.Methods allMethods
protected jodd.introspector.Properties publicProperties
protected jodd.introspector.Properties allProperties
protected jodd.introspector.Ctors publicCtors
protected jodd.introspector.Ctors allCtors
public ClassDescriptor(java.lang.Class type,
boolean accessibleOnly)
public java.lang.Class getType()
protected void increaseUsageCount()
public int getUsageCount()
public boolean isArray()
true if class is an array.public boolean isMap()
true if class is a Map.public boolean isList()
true if class is a List.public boolean isSet()
true if type is a Set.public boolean isCollection()
true if type is a collection.protected void inspectFields()
public java.lang.reflect.Field getField(java.lang.String name,
boolean declared)
null if not found.name - field namedeclared - whether to look at non-public ones.public int getFieldsCount(boolean declared)
public java.lang.reflect.Field[] getAllFields(boolean declared)
public FieldDescriptor getFieldDescriptor(java.lang.String name, boolean declared)
protected void inspectMethods()
public int getMethodsCount(boolean declared)
public java.lang.reflect.Method getMethod(java.lang.String name,
boolean declared)
null if not found.name - method namedeclared - whether to look at non-public ones.public java.lang.reflect.Method getMethod(java.lang.String name,
java.lang.Class[] params,
boolean declared)
public MethodDescriptor getMethodDescriptor(java.lang.String name, java.lang.Class[] params, boolean declared)
method descriptor identified by name and parameters.public java.lang.reflect.Method[] getAllMethods(java.lang.String name,
boolean declared)
public java.lang.reflect.Method[] getAllMethods(boolean declared)
protected void inspectProperties()
public java.lang.reflect.Method getBeanSetter(java.lang.String name,
boolean declared)
public MethodDescriptor getBeanSetterMethodDescriptor(java.lang.String name, boolean declared)
MethodDescriptor identified by name.public java.lang.reflect.Method[] getAllBeanSetters(boolean declared)
public java.lang.String[] getAllBeanSetterNames(boolean declared)
public java.lang.reflect.Method getBeanGetter(java.lang.String name,
boolean declared)
public MethodDescriptor getBeanGetterMethodDescriptor(java.lang.String name, boolean declared)
MethodDescriptor for bean setter identified by name.public java.lang.reflect.Method[] getAllBeanGetters(boolean declared)
public java.lang.String[] getAllBeanGetterNames(boolean declared)
protected void inspectCtors()
public java.lang.reflect.Constructor getDefaultCtor(boolean declared)
null if not found.public java.lang.reflect.Constructor getCtor(java.lang.Class[] args,
boolean declared)
null if not found.args - ctor argumentsdeclared - whether to look at non-public ones.public java.lang.reflect.Constructor getDefaultCtor()
null if not found.public int getCtorsCount(boolean declared)
public java.lang.reflect.Constructor[] getAllCtors(boolean declared)
Copyright © 2003-2013 Jodd Team