Package jodd.introspector
Class ClassDescriptor
java.lang.Object
jodd.introspector.ClassDescriptor
A descriptor class for all methods/fields/properties/constructors of a class.
Static methods/fields are ignored.
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Ctorsprotected final booleanprivate Fieldsprotected final booleanprotected final Class[]private final booleanprivate final booleanprivate final booleanprivate final booleanprivate final booleanprivate final booleanprivate booleanprivate Methodsprivate Propertiesprotected final String[]protected final booleanprotected final Class[]protected final Class -
Constructor Summary
ConstructorsConstructorDescriptionClassDescriptor(Class type, boolean scanAccessible, boolean extendedProperties, boolean includeFieldsAsProperties, String[] propertyFieldPrefix) -
Method Summary
Modifier and TypeMethodDescriptionReturns an array of allconstructor descriptors.Returns all field descriptors, including declared ones.Class[]Returns all interfaces of this class.Returns an array of all methods.Returns an array of all methods with the same name.Returns all properties descriptors.Class[]Returns all superclasses of this class.getCtorDescriptor(Class[] args, boolean declared) Returns the constructor identified by arguments ornullif not found.protected CtorsgetCtors()Returns constructors collection.getDefaultCtorDescriptor(boolean declared) Returns the default ctor ornullif not found.getFieldDescriptor(String name, boolean declared) Returns field descriptor.protected FieldsReturnsfields collection.getMethodDescriptor(String name, boolean declared) Returnsmethod descriptoridentified by name and parameters.getMethodDescriptor(String name, Class[] params, boolean declared) Returnsmethod descriptoridentified by name and parameters.protected MethodsReturns methods collection.protected PropertiesReturns properties collection.getPropertyDescriptor(String name, boolean declared) Returns property descriptor.String[]Returns property field prefixes.getType()Get the class object that this descriptor describes.booleanisArray()Returnstrueif class is an array.booleanReturnstrueif type is a collection.booleanReturnstrueif properties in this class descriptor are extended and include field description.booleanInclude fields as properties.booleanisList()Returnstrueif class is aList.booleanisMap()Returnstrueif class is aMap.booleanReturnstrueif this class descriptor works with accessible fields/methods/constructors or with all supported.booleanisSet()Returnstrueif type is aSet.booleanReturnstrueif type is a supplier.booleanReturnstrueis class is a system class and should not expose fields or declared methods.
-
Field Details
-
type
-
scanAccessible
protected final boolean scanAccessible -
extendedProperties
protected final boolean extendedProperties -
includeFieldsAsProperties
protected final boolean includeFieldsAsProperties -
propertyFieldPrefix
-
interfaces
-
superclasses
-
isArray
private final boolean isArray -
isMap
private final boolean isMap -
isList
private final boolean isList -
isSet
private final boolean isSet -
isCollection
private final boolean isCollection -
isSupplier
private final boolean isSupplier -
isSystemClass
private boolean isSystemClass -
fields
-
methods
-
properties
-
ctors
-
-
Constructor Details
-
ClassDescriptor
-
-
Method Details
-
getType
Get the class object that this descriptor describes. -
isScanAccessible
public boolean isScanAccessible()Returnstrueif this class descriptor works with accessible fields/methods/constructors or with all supported. -
isExtendedProperties
public boolean isExtendedProperties()Returnstrueif properties in this class descriptor are extended and include field description. -
isIncludeFieldsAsProperties
public boolean isIncludeFieldsAsProperties()Include fields as properties. -
getPropertyFieldPrefix
Returns property field prefixes. May benullif prefixes are not set. If you need to access both prefixed and non-prefixed fields, use empty string as one of the prefixes. -
isArray
public boolean isArray()Returnstrueif class is an array. -
isMap
public boolean isMap()Returnstrueif class is aMap. -
isList
public boolean isList()Returnstrueif class is aList. -
isSet
public boolean isSet()Returnstrueif type is aSet. -
isCollection
public boolean isCollection()Returnstrueif type is a collection. -
isSupplier
public boolean isSupplier()Returnstrueif type is a supplier. -
isSystemClass
public boolean isSystemClass()Returnstrueis class is a system class and should not expose fields or declared methods. -
getFields
Returnsfields collection. Creates new fields collection on first usage. -
getFieldDescriptor
Returns field descriptor. -
getAllFieldDescriptors
Returns all field descriptors, including declared ones. -
getMethods
Returns methods collection. Creates new collection on first access. -
getMethodDescriptor
Returnsmethod descriptoridentified by name and parameters. -
getMethodDescriptor
Returnsmethod descriptoridentified by name and parameters. -
getAllMethodDescriptors
Returns an array of all methods with the same name. -
getAllMethodDescriptors
Returns an array of all methods. -
getProperties
Returns properties collection. Creates new collection on first access. -
getPropertyDescriptor
Returns property descriptor. Declared flag is matched on both read and write methods. -
getAllPropertyDescriptors
Returns all properties descriptors. -
getCtors
Returns constructors collection. Creates new collection of first access. -
getDefaultCtorDescriptor
Returns the default ctor ornullif not found. -
getCtorDescriptor
Returns the constructor identified by arguments ornullif not found. -
getAllCtorDescriptors
Returns an array of allconstructor descriptors. -
getAllInterfaces
Returns all interfaces of this class. -
getAllSuperclasses
Returns all superclasses of this class.Object.classis not included in the returned list.
-