public class Introspector extends Object
Finding methods as well as property getters & setters.
Modifier and Type | Field and Description |
---|---|
protected Log |
rlog
The logger to use for all warnings & errors.
|
Modifier | Constructor and Description |
---|---|
protected |
Introspector(Log log)
Creates an introspector.
|
Modifier and Type | Method and Description |
---|---|
protected IntrospectorBase |
base()
Gets the current introspector base.
|
Class<?> |
getClassByName(String className)
Gets a class by name through this introspector class loader.
|
Constructor<?> |
getConstructor(Object ctorHandle,
Object[] args)
Returns a general constructor.
|
Field |
getField(Class<?> c,
String key)
Gets the field named by
key for the class c . |
String[] |
getFieldNames(Class<?> c)
Gets the accessible field names known for a given class.
|
AbstractExecutor.Get |
getGetExecutor(Object obj,
Object identifier)
Return a property getter.
|
Method |
getMethod(Class<?> c,
MethodKey key)
Gets the method defined by
key and for the Class c . |
Method |
getMethod(Class<?> c,
String name,
Object[] params)
Gets the method defined by
name and
params for the Class c . |
AbstractExecutor.Method |
getMethodExecutor(Object obj,
String name,
Object[] args)
Returns a general method.
|
String[] |
getMethodNames(Class<?> c)
Gets the accessible methods names known for a given class.
|
Method[] |
getMethods(Class<?> c,
String methodName)
Gets all the methods with a given name from this map.
|
AbstractExecutor.Set |
getSetExecutor(Object obj,
Object identifier,
Object arg)
Return a property setter.
|
void |
setClassLoader(ClassLoader loader)
Sets the underlying class loader for class solving resolution.
|
protected Integer |
toInteger(Object arg)
Coerce an Object to an Integer.
|
protected String |
toString(Object arg)
Coerce an Object to a String.
|
protected final Log rlog
protected Introspector(Log log)
log
- the logger to use for warnings.protected Integer toInteger(Object arg)
arg
- the Object to coerceprotected String toString(Object arg)
arg
- the Object to coerceprotected final IntrospectorBase base()
If the reference has been collected, this method will recreate the underlying introspector.
public void setClassLoader(ClassLoader loader)
loader
- the loader to usepublic Class<?> getClassByName(String className)
className
- the class namepublic final Field getField(Class<?> c, String key)
key
for the class c
.c
- Class in which the field search is taking placekey
- Name of the field being searched forField
or null if it does not exist or is not accessiblepublic final String[] getFieldNames(Class<?> c)
c
- the classpublic final Method getMethod(Class<?> c, String name, Object[] params)
name
and
params
for the Class c
.c
- Class in which the method search is taking placename
- Name of the method being searched forparams
- An array of Objects (not Classes) that describe the
the parametersMethod
or null if no unambiguous method could be found through introspection.public final Method getMethod(Class<?> c, MethodKey key)
key
and for the Class c
.c
- Class in which the method search is taking placekey
- MethodKey of the method being searched forMethod
or null if no unambiguous method could be found through introspection.public final String[] getMethodNames(Class<?> c)
c
- the classpublic final Method[] getMethods(Class<?> c, String methodName)
c
- the classmethodName
- the seeked methods namepublic final Constructor<?> getConstructor(Object ctorHandle, Object[] args)
ctorHandle
- the objectargs
- contructor argumentsConstructor
or null if no unambiguous contructor could be found through introspection.public final AbstractExecutor.Method getMethodExecutor(Object obj, String name, Object[] args)
obj
- the objectname
- the method nameargs
- method argumentsAbstractExecutor.Method
.public final AbstractExecutor.Get getGetExecutor(Object obj, Object identifier)
obj
- the object to base the property from.identifier
- property nameAbstractExecutor.Get
.public final AbstractExecutor.Set getSetExecutor(Object obj, Object identifier, Object arg)
obj
- the object to base the property from.identifier
- property name (or identifier)arg
- value to setAbstractExecutor.Set
.Copyright © 2016 Internet2. All rights reserved.