|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjodd.introspector.ClassDescriptor
public class ClassDescriptor
A descriptor class for all methods/fields/constructors of a class. Static methods/fields are ignored. Hash table is pre-built to speed up query.
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.
| Field Summary | |
|---|---|
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 Summary | |
|---|---|
ClassDescriptor(java.lang.Class type,
boolean accessibleOnly)
|
|
| Method Summary | |
|---|---|
java.lang.String[] |
getAllBeanGetterNames()
Returns all public bean getters names. |
java.lang.String[] |
getAllBeanGetterNames(boolean suppressSecurity)
Returns all bean getters names. |
java.lang.reflect.Method[] |
getAllBeanGetters()
Returns all public bean getters. |
java.lang.reflect.Method[] |
getAllBeanGetters(boolean suppressSecurity)
Returns all bean getters. |
java.lang.String[] |
getAllBeanSetterNames()
Returns an array of all public bean setters names. |
java.lang.String[] |
getAllBeanSetterNames(boolean suppressSecurity)
Returns an array of all bean setters names. |
java.lang.reflect.Method[] |
getAllBeanSetters()
Returns an array of all public bean setters. |
java.lang.reflect.Method[] |
getAllBeanSetters(boolean suppressSecurity)
Returns an array of all bean setters. |
java.lang.reflect.Constructor[] |
getAllCtors()
Returns an array of all public ctors. |
java.lang.reflect.Constructor[] |
getAllCtors(boolean suppressSecurity)
Returns an array of all ctors. |
java.lang.reflect.Field[] |
getAllFields()
Returns an array of all public fields. |
java.lang.reflect.Field[] |
getAllFields(boolean suppressSecurity)
Returns an array of all fields. |
java.lang.reflect.Method[] |
getAllMethods()
Returns an array of all public methods. |
java.lang.reflect.Method[] |
getAllMethods(boolean supressSecurity)
Returns an array of all methods. |
java.lang.reflect.Method[] |
getAllMethods(java.lang.String name)
Returns an array of all public methods with the same name. |
java.lang.reflect.Method[] |
getAllMethods(java.lang.String name,
boolean supressSecurity)
Returns an array of all methods with the same name. |
java.lang.reflect.Method |
getBeanGetter(java.lang.String name)
Returns public bean getter identified by name. |
java.lang.reflect.Method |
getBeanGetter(java.lang.String name,
boolean suppressSecurity)
Returns bean getter identified by name. |
java.lang.reflect.Method |
getBeanSetter(java.lang.String name)
Returns public bean setter identified by name. |
java.lang.reflect.Method |
getBeanSetter(java.lang.String name,
boolean suppressSecurity)
Returns bean setter identified by name. |
java.lang.reflect.Constructor |
getCtor(java.lang.Class[] args)
Returns the public ctor identified by arguments or null if not found. |
java.lang.reflect.Constructor |
getCtor(java.lang.Class[] args,
boolean suppressSecurity)
Returns the constructor identified by arguments or null if not found. |
int |
getCtorCount()
Returns the total number of public constructors. |
int |
getCtorCount(boolean suppressSecurity)
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 suppressSecurity)
Returns the default ctor or null if not found. |
java.lang.reflect.Field |
getField(java.lang.String name)
Returns the public field identified by name or null if not found. |
java.lang.reflect.Field |
getField(java.lang.String name,
boolean suppressSecurity)
Returns the field identified by name or null if not found. |
int |
getFieldCount()
Returns the total number of public fields. |
int |
getFieldCount(boolean suppressSecurity)
Returns the total number of fields. |
java.lang.reflect.Method |
getMethod(java.lang.String name)
Returns the public method identified by name or null if not found. |
java.lang.reflect.Method |
getMethod(java.lang.String name,
boolean suppressSecurity)
Returns the method identified by name or null if not found. |
java.lang.reflect.Method |
getMethod(java.lang.String name,
java.lang.Class[] params)
Returns the public method identified by name and parameters. |
java.lang.reflect.Method |
getMethod(java.lang.String name,
java.lang.Class[] params,
boolean suppressSecurity)
Returns the method identified by name and parameters. |
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()
|
boolean |
isList()
Returns true if class is a List. |
boolean |
isMap()
Returns true if class is a Map. |
boolean |
isSet()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
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
| Constructor Detail |
|---|
public ClassDescriptor(java.lang.Class type,
boolean accessibleOnly)
| Method Detail |
|---|
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()
public boolean isCollection()
protected void inspectFields()
public java.lang.reflect.Field getField(java.lang.String name,
boolean suppressSecurity)
null if not found.
name - field namesuppressSecurity - whether to look at non-public ones.public java.lang.reflect.Field getField(java.lang.String name)
null if not found.
public int getFieldCount(boolean suppressSecurity)
public int getFieldCount()
public java.lang.reflect.Field[] getAllFields(boolean suppressSecurity)
public java.lang.reflect.Field[] getAllFields()
protected void inspectMethods()
public java.lang.reflect.Method getMethod(java.lang.String name,
boolean suppressSecurity)
null if not found.
name - method namesuppressSecurity - whether to look at non-public ones.public java.lang.reflect.Method getMethod(java.lang.String name)
null if not found.
public java.lang.reflect.Method getMethod(java.lang.String name,
java.lang.Class[] params,
boolean suppressSecurity)
public java.lang.reflect.Method getMethod(java.lang.String name,
java.lang.Class[] params)
public java.lang.reflect.Method[] getAllMethods(java.lang.String name,
boolean supressSecurity)
public java.lang.reflect.Method[] getAllMethods(java.lang.String name)
public java.lang.reflect.Method[] getAllMethods(boolean supressSecurity)
public java.lang.reflect.Method[] getAllMethods()
protected void inspectProperties()
public java.lang.reflect.Method getBeanSetter(java.lang.String name,
boolean suppressSecurity)
public java.lang.reflect.Method getBeanSetter(java.lang.String name)
public java.lang.reflect.Method[] getAllBeanSetters(boolean suppressSecurity)
public java.lang.reflect.Method[] getAllBeanSetters()
public java.lang.String[] getAllBeanSetterNames(boolean suppressSecurity)
public java.lang.String[] getAllBeanSetterNames()
public java.lang.reflect.Method getBeanGetter(java.lang.String name,
boolean suppressSecurity)
public java.lang.reflect.Method getBeanGetter(java.lang.String name)
public java.lang.reflect.Method[] getAllBeanGetters(boolean suppressSecurity)
public java.lang.reflect.Method[] getAllBeanGetters()
public java.lang.String[] getAllBeanGetterNames(boolean suppressSecurity)
public java.lang.String[] getAllBeanGetterNames()
protected void inspectCtors()
public java.lang.reflect.Constructor getDefaultCtor(boolean suppressSecurity)
null if not found.
public java.lang.reflect.Constructor getCtor(java.lang.Class[] args,
boolean suppressSecurity)
null if not found.
args - ctor argumentssuppressSecurity - whether to look at non-public ones.public java.lang.reflect.Constructor getCtor(java.lang.Class[] args)
null if not found.
public java.lang.reflect.Constructor getDefaultCtor()
null if not found.
public int getCtorCount(boolean suppressSecurity)
public int getCtorCount()
public java.lang.reflect.Constructor[] getAllCtors(boolean suppressSecurity)
public java.lang.reflect.Constructor[] getAllCtors()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||