Top Description Fields Constructors Methods
org.apache.commons.jexl2.internal

public Class Introspector

extends Object
Class Inheritance
Known Direct Subclasses
org.apache.commons.jexl2.introspection.UberspectImpl
Imports
java.lang.ref.SoftReference, java.lang.reflect.Method, .Constructor, .Field, org.apache.commons.jexl2.internal.introspection.IntrospectorBase, .MethodKey, org.apache.commons.logging.Log

Default introspection services.

Finding methods as well as property getters & setters.

Since
1.0

Field Summary

Modifier and TypeField and Description
private volatile SoftReference<IntrospectorBase>
ref

The soft reference to the introspector currently in use.

protected final Log
rlog

The logger to use for all warnings & errors.

Constructor Summary

AccessConstructor and Description
protected
Introspector(Log
the logger to use for warnings.
log
)

Creates an introspector.

Method Summary

Modifier and TypeMethod and Description
protected final IntrospectorBase

Returns:

the introspector
base
()

Gets the current introspector base.

public Class<?>

Returns:

the class instance or null if it could not be found
getClassByName
(String
the class name
className
)

Gets a class by name through this introspector class loader.

public final Constructor<?>

Returns:

a java.lang.reflect.Constructor or null if no unambiguous contructor could be found through introspection.
getConstructor
(Object
the object
ctorHandle
,
Object[]
contructor arguments
args
)

Returns a general constructor.

public final Field

Returns:

a java.lang.reflect.Field or null if it does not exist or is not accessible
getField
(Class<?>
Class in which the field search is taking place
c
,
String
Name of the field being searched for
key
)

Gets the field named by key for the class c.

public final String[]

Returns:

the class field names
getFieldNames
(Class<?>
the class
c
)

Gets the accessible field names known for a given class.

public final AbstractExecutor.Get
getGetExecutor(Object
the object to base the property from.
obj
,
Object
property name
identifier
)

Return a property getter.

public final Method

Returns:

a java.lang.reflect.Method or null if no unambiguous method could be found through introspection.
getMethod
(Class<?>
Class in which the method search is taking place
c
,
String
Name of the method being searched for
name
,
Object[]
An array of Objects (not Classes) that describe the the parameters
params
)

Gets the method defined by name and params for the Class c.

public final Method

Returns:

a java.lang.reflect.Method or null if no unambiguous method could be found through introspection.
getMethod
(Class<?>
Class in which the method search is taking place
c
,
MethodKey
MethodKey of the method being searched for
key
)

Gets the method defined by key and for the Class c.

public final AbstractExecutor.Method
getMethodExecutor(Object
the object
obj
,
String
the method name
name
,
Object[]
method arguments
args
)

Returns a general method.

public final String[]

Returns:

the class method names
getMethodNames
(Class<?>
the class
c
)

Gets the accessible methods names known for a given class.

public final Method[]

Returns:

the array of methods
getMethods
(Class<?>
the class
c
,
final String
the seeked methods name
methodName
)

Gets all the methods with a given name from this map.

public final AbstractExecutor.Set
getSetExecutor(final Object
the object to base the property from.
obj
,
final Object
property name (or identifier)
identifier
,
Object
value to set
arg
)

Return a property setter.

public void
setClassLoader(ClassLoader
the loader to use
loader
)

Sets the underlying class loader for class solving resolution.

protected Integer

Returns:

an Integer if it can be converted, null otherwise
toInteger
(Object
the Object to coerce
arg
)

Coerce an Object to an Integer.

protected String

Returns:

a String if it can be converted, null otherwise
toString
(Object
the Object to coerce
arg
)

Coerce an Object to a String.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

refback to summary
private volatile SoftReference<IntrospectorBase> ref

The soft reference to the introspector currently in use.

rlogback to summary
protected final Log rlog

The logger to use for all warnings & errors.

Constructor Detail

Introspectorback to summary
protected Introspector(Log log)

Creates an introspector.

Parameters
log:Log

the logger to use for warnings.

Method Detail

baseback to summary
protected final IntrospectorBase base()

Gets the current introspector base.

If the reference has been collected, this method will recreate the underlying introspector.

Returns:IntrospectorBase

the introspector

getClassByNameback to summary
public Class<?> getClassByName(String className)

Gets a class by name through this introspector class loader.

Parameters
className:String

the class name

Returns:Class<?>

the class instance or null if it could not be found

getConstructorback to summary
public final Constructor<?> getConstructor(Object ctorHandle, Object[] args)

Returns a general constructor.

Parameters
ctorHandle:Object

the object

args:Object[]

contructor arguments

Returns:Constructor<?>

a java.lang.reflect.Constructor or null if no unambiguous contructor could be found through introspection.

getFieldback to summary
public final Field getField(Class<?> c, String key)

Gets the field named by key for the class c.

Parameters
c:Class<?>

Class in which the field search is taking place

key:String

Name of the field being searched for

Returns:Field

a java.lang.reflect.Field or null if it does not exist or is not accessible

getFieldNamesback to summary
public final String[] getFieldNames(Class<?> c)

Gets the accessible field names known for a given class.

Parameters
c:Class<?>

the class

Returns:String[]

the class field names

getGetExecutorback to summary
public final AbstractExecutor.Get getGetExecutor(Object obj, Object identifier)

Return a property getter.

Parameters
obj:Object

the object to base the property from.

identifier:Object

property name

Returns:AbstractExecutor.Get

a AbstractExecutor.Get.

getMethodback to summary
public final Method getMethod(Class<?> c, String name, Object[] params)

Gets the method defined by name and params for the Class c.

Parameters
c:Class<?>

Class in which the method search is taking place

name:String

Name of the method being searched for

params:Object[]

An array of Objects (not Classes) that describe the the parameters

Returns:Method

a java.lang.reflect.Method or null if no unambiguous method could be found through introspection.

getMethodback to summary
public final Method getMethod(Class<?> c, MethodKey key)

Gets the method defined by key and for the Class c.

Parameters
c:Class<?>

Class in which the method search is taking place

key:MethodKey

MethodKey of the method being searched for

Returns:Method

a java.lang.reflect.Method or null if no unambiguous method could be found through introspection.

getMethodExecutorback to summary
public final AbstractExecutor.Method getMethodExecutor(Object obj, String name, Object[] args)

Returns a general method.

Parameters
obj:Object

the object

name:String

the method name

args:Object[]

method arguments

Returns:AbstractExecutor.Method

a AbstractExecutor.Method.

getMethodNamesback to summary
public final String[] getMethodNames(Class<?> c)

Gets the accessible methods names known for a given class.

Parameters
c:Class<?>

the class

Returns:String[]

the class method names

getMethodsback to summary
public final Method[] getMethods(Class<?> c, final String methodName)

Gets all the methods with a given name from this map.

Parameters
c:Class<?>

the class

methodName:String

the seeked methods name

Returns:Method[]

the array of methods

getSetExecutorback to summary
public final AbstractExecutor.Set getSetExecutor(final Object obj, final Object identifier, Object arg)

Return a property setter.

Parameters
obj:Object

the object to base the property from.

identifier:Object

property name (or identifier)

arg:Object

value to set

Returns:AbstractExecutor.Set

a AbstractExecutor.Set.

setClassLoaderback to summary
public void setClassLoader(ClassLoader loader)

Sets the underlying class loader for class solving resolution.

Parameters
loader:ClassLoader

the loader to use

toIntegerback to summary
protected Integer toInteger(Object arg)

Coerce an Object to an Integer.

Parameters
arg:Object

the Object to coerce

Returns:Integer

an Integer if it can be converted, null otherwise

toStringback to summary
protected String toString(Object arg)

Coerce an Object to a String.

Parameters
arg:Object

the Object to coerce

Returns:String

a String if it can be converted, null otherwise