public class ClassDescriptor
extends java.lang.Object
Descriptors are 'lazy': various internal caches are created on first 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 |
extendedProperties |
protected boolean |
includeFieldsAsProperties |
protected java.lang.Class[] |
interfaces |
protected java.lang.String[] |
propertyFieldPrefix |
protected boolean |
scanAccessible |
protected java.lang.Class[] |
superclasses |
protected java.lang.Class |
type |
Constructor and Description |
---|
ClassDescriptor(java.lang.Class type,
boolean scanAccessible,
boolean extendedProperties,
boolean includeFieldsAsProperties,
java.lang.String[] propertyFieldPrefix) |
Modifier and Type | Method and Description |
---|---|
CtorDescriptor[] |
getAllCtorDescriptors()
Returns an array of all
constructor descriptors . |
FieldDescriptor[] |
getAllFieldDescriptors()
Returns all field descriptors, including declared ones.
|
java.lang.Class[] |
getAllInterfaces()
Returns all interfaces of this class.
|
MethodDescriptor[] |
getAllMethodDescriptors()
Returns an array of all methods.
|
MethodDescriptor[] |
getAllMethodDescriptors(java.lang.String name)
Returns an array of all methods with the same name.
|
PropertyDescriptor[] |
getAllPropertyDescriptors()
Returns all properties descriptors.
|
java.lang.Class[] |
getAllSuperclasses()
Returns all superclasses of this class.
|
CtorDescriptor |
getCtorDescriptor(java.lang.Class[] args,
boolean declared)
Returns the constructor identified by arguments or
null if not found. |
protected Ctors |
getCtors()
Returns constructors collection.
|
CtorDescriptor |
getDefaultCtorDescriptor(boolean declared)
Returns the default ctor or
null if not found. |
FieldDescriptor |
getFieldDescriptor(java.lang.String name,
boolean declared)
Returns field descriptor.
|
protected Fields |
getFields()
Returns
fields collection . |
MethodDescriptor |
getMethodDescriptor(java.lang.String name,
boolean declared)
Returns
method descriptor 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. |
protected Methods |
getMethods()
Returns methods collection.
|
protected Properties |
getProperties()
Returns properties collection.
|
PropertyDescriptor |
getPropertyDescriptor(java.lang.String name,
boolean declared)
Returns property descriptor.
|
java.lang.String[] |
getPropertyFieldPrefix()
Returns property field prefixes.
|
java.lang.Class |
getType()
Get the class object that this descriptor describes.
|
boolean |
isArray()
Returns
true if class is an array. |
boolean |
isCollection()
Returns
true if type is a collection. |
boolean |
isExtendedProperties()
Returns
true if properties in this class descriptor
are extended and include field description. |
boolean |
isIncludeFieldsAsProperties()
Include fields as properties.
|
boolean |
isList()
Returns
true if class is a List . |
boolean |
isMap()
Returns
true if class is a Map . |
boolean |
isScanAccessible()
Returns
true if this class descriptor
works with accessible fields/methods/constructors or with
all supported. |
boolean |
isSet()
Returns
true if type is a Set . |
boolean |
isSupplier()
Returns
true if type is a supplier. |
boolean |
isSystemClass()
Returns
true is class is a system class and should not
expose fields or declared methods. |
protected final java.lang.Class type
protected final boolean scanAccessible
protected final boolean extendedProperties
protected final boolean includeFieldsAsProperties
protected final java.lang.String[] propertyFieldPrefix
protected final java.lang.Class[] interfaces
protected final java.lang.Class[] superclasses
public ClassDescriptor(java.lang.Class type, boolean scanAccessible, boolean extendedProperties, boolean includeFieldsAsProperties, java.lang.String[] propertyFieldPrefix)
public java.lang.Class getType()
public boolean isScanAccessible()
true
if this class descriptor
works with accessible fields/methods/constructors or with
all supported.public boolean isExtendedProperties()
true
if properties in this class descriptor
are extended and include field description.public boolean isIncludeFieldsAsProperties()
public java.lang.String[] getPropertyFieldPrefix()
null
if prefixes are not set. If you need to access both prefixed
and non-prefixed fields, use empty string as one of the prefixes.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.public boolean isSupplier()
true
if type is a supplier.public boolean isSystemClass()
true
is class is a system class and should not
expose fields or declared methods.protected Fields getFields()
fields collection
.
Creates new fields collection on first usage.public FieldDescriptor getFieldDescriptor(java.lang.String name, boolean declared)
public FieldDescriptor[] getAllFieldDescriptors()
protected Methods getMethods()
public MethodDescriptor getMethodDescriptor(java.lang.String name, boolean declared)
method descriptor
identified by name and parameters.public MethodDescriptor getMethodDescriptor(java.lang.String name, java.lang.Class[] params, boolean declared)
method descriptor
identified by name and parameters.public MethodDescriptor[] getAllMethodDescriptors(java.lang.String name)
public MethodDescriptor[] getAllMethodDescriptors()
protected Properties getProperties()
public PropertyDescriptor getPropertyDescriptor(java.lang.String name, boolean declared)
public PropertyDescriptor[] getAllPropertyDescriptors()
protected Ctors getCtors()
public CtorDescriptor getDefaultCtorDescriptor(boolean declared)
null
if not found.public CtorDescriptor getCtorDescriptor(java.lang.Class[] args, boolean declared)
null
if not found.public CtorDescriptor[] getAllCtorDescriptors()
constructor descriptors
.public java.lang.Class[] getAllInterfaces()
public java.lang.Class[] getAllSuperclasses()
Object.class
is not included in the
returned list.Copyright © 2003-present Jodd Team