|
||||||||||
| 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 Class |
type
|
protected int |
usageCount
|
| Constructor Summary | |
|---|---|
ClassDescriptor(Class type,
boolean accessibleOnly)
|
|
| Method Summary | |
|---|---|
String[] |
getAllBeanGetterNames()
Returns all public bean getters names. |
String[] |
getAllBeanGetterNames(boolean suppressSecurity)
Returns all bean getters names. |
Method[] |
getAllBeanGetters()
Returns all public bean getters. |
Method[] |
getAllBeanGetters(boolean suppressSecurity)
Returns all bean getters. |
String[] |
getAllBeanSetterNames()
Returns an array of all public bean setters names. |
String[] |
getAllBeanSetterNames(boolean suppressSecurity)
Returns an array of all bean setters names. |
Method[] |
getAllBeanSetters()
Returns an array of all public bean setters. |
Method[] |
getAllBeanSetters(boolean suppressSecurity)
Returns an array of all bean setters. |
Constructor[] |
getAllCtors()
Returns an array of all public ctors. |
Constructor[] |
getAllCtors(boolean suppressSecurity)
Returns an array of all ctors. |
Field[] |
getAllFields()
Returns an array of all public fields. |
Field[] |
getAllFields(boolean suppressSecurity)
Returns an array of all fields. |
Method[] |
getAllMethods()
Returns an array of all public methods. |
Method[] |
getAllMethods(boolean supressSecurity)
Returns an array of all methods. |
Method[] |
getAllMethods(String name)
Returns an array of all public methods with the same name. |
Method[] |
getAllMethods(String name,
boolean supressSecurity)
Returns an array of all methods with the same name. |
Method |
getBeanGetter(String name)
Returns public bean getter identified by name. |
Method |
getBeanGetter(String name,
boolean suppressSecurity)
Returns bean getter identified by name. |
Method |
getBeanSetter(String name)
Returns public bean setter identified by name. |
Method |
getBeanSetter(String name,
boolean suppressSecurity)
Returns bean setter identified by name. |
Constructor |
getCtor(Class[] args)
Returns the public ctor identified by arguments or null if not found. |
Constructor |
getCtor(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. |
Constructor |
getDefaultCtor()
Returns the public default ctor or null if not found. |
Constructor |
getDefaultCtor(boolean suppressSecurity)
Returns the default ctor or null if not found. |
Field |
getField(String name)
Returns the public field identified by name or null if not found. |
Field |
getField(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. |
Method |
getMethod(String name)
Returns the public method identified by name or null if not found. |
Method |
getMethod(String name,
boolean suppressSecurity)
Returns the method identified by name or null if not found. |
Method |
getMethod(String name,
Class[] params)
Returns the public method identified by name and parameters. |
Method |
getMethod(String name,
Class[] params,
boolean suppressSecurity)
Returns the method identified by name and parameters. |
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 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(Class type,
boolean accessibleOnly)
| Method Detail |
|---|
public 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 Field getField(String name,
boolean suppressSecurity)
null if not found.
name - field namesuppressSecurity - whether to look at non-public ones.public Field getField(String name)
null if not found.
public int getFieldCount(boolean suppressSecurity)
public int getFieldCount()
public Field[] getAllFields(boolean suppressSecurity)
public Field[] getAllFields()
protected void inspectMethods()
public Method getMethod(String name,
boolean suppressSecurity)
null if not found.
name - method namesuppressSecurity - whether to look at non-public ones.public Method getMethod(String name)
null if not found.
public Method getMethod(String name,
Class[] params,
boolean suppressSecurity)
public Method getMethod(String name,
Class[] params)
public Method[] getAllMethods(String name,
boolean supressSecurity)
public Method[] getAllMethods(String name)
public Method[] getAllMethods(boolean supressSecurity)
public Method[] getAllMethods()
protected void inspectProperties()
public Method getBeanSetter(String name,
boolean suppressSecurity)
public Method getBeanSetter(String name)
public Method[] getAllBeanSetters(boolean suppressSecurity)
public Method[] getAllBeanSetters()
public String[] getAllBeanSetterNames(boolean suppressSecurity)
public String[] getAllBeanSetterNames()
public Method getBeanGetter(String name,
boolean suppressSecurity)
public Method getBeanGetter(String name)
public Method[] getAllBeanGetters(boolean suppressSecurity)
public Method[] getAllBeanGetters()
public String[] getAllBeanGetterNames(boolean suppressSecurity)
public String[] getAllBeanGetterNames()
protected void inspectCtors()
public Constructor getDefaultCtor(boolean suppressSecurity)
null if not found.
public Constructor getCtor(Class[] args,
boolean suppressSecurity)
null if not found.
args - ctor argumentssuppressSecurity - whether to look at non-public ones.public Constructor getCtor(Class[] args)
null if not found.
public Constructor getDefaultCtor()
null if not found.
public int getCtorCount(boolean suppressSecurity)
public int getCtorCount()
public Constructor[] getAllCtors(boolean suppressSecurity)
public Constructor[] getAllCtors()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||