Top Description Fields Constructors Methods
org.apache.catalina.util

public Class Introspection

extends Object
Class Inheritance
Imports
java.beans.Introspector, java.lang.reflect.Field, .Method, .Modifier, java.security.AccessController, .PrivilegedAction, org.apache.catalina.Context, .Globals, org.apache.juli.logging.Log, org.apache.tomcat.util.ExceptionUtils, org.apache.tomcat.util.res.StringManager

Provides introspection utilities that either require knowledge of Tomcat internals or are solely used by Tomcat internals.

Field Summary

Modifier and TypeField and Description
private static final StringManager

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static Class<?>

Returns:

if the parameter is a primitive type returns its wrapper; otherwise returns the same class
convertPrimitiveType
(Class<?>
Class that will be evaluated
clazz
)

Converts the primitive type to its corresponding wrapper.

public static Field[]

Returns:

the class fields as an array
getDeclaredFields
(final Class<?>
The class to introspect
clazz
)

Obtain the declared fields for a class taking account of any security manager that may be configured.

public static Method[]

Returns:

the class methods as an array
getDeclaredMethods
(final Class<?>
The class to introspect
clazz
)

Obtain the declared methods for a class taking account of any security manager that may be configured.

public static String

Returns:

the bean property name
getPropertyName
(Method
The setter method
setter
)

Extract the Java Bean property name from the setter name.

public static boolean

Returns:

true if the method is a valid lifecycle callback method, else false
isValidLifecycleCallback
(Method
The method to test
method
)

Determines if a method is a valid lifecycle callback method.

public static boolean

Returns:

true if the method does have a valid name and signature, else false
isValidSetter
(Method
The method to test
method
)

Determines if a method has a valid name and signature for a Java Bean setter.

public static Class<?>

Returns:

the loaded class or null if loading failed
loadClass
(Context
The class loader of this context will be used to attempt to load the class
context
,
String
The class name
className
)

Attempt to load a class using the given Container's class loader.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

smback to summary
private static final StringManager sm

Constructor Detail

Introspectionback to summary
public Introspection()

Method Detail

convertPrimitiveTypeback to summary
public static Class<?> convertPrimitiveType(Class<?> clazz)

Converts the primitive type to its corresponding wrapper.

Parameters
clazz:Class<?>

Class that will be evaluated

Returns:Class<?>

if the parameter is a primitive type returns its wrapper; otherwise returns the same class

getDeclaredFieldsback to summary
public static Field[] getDeclaredFields(final Class<?> clazz)

Obtain the declared fields for a class taking account of any security manager that may be configured.

Parameters
clazz:Class<?>

The class to introspect

Returns:Field[]

the class fields as an array

getDeclaredMethodsback to summary
public static Method[] getDeclaredMethods(final Class<?> clazz)

Obtain the declared methods for a class taking account of any security manager that may be configured.

Parameters
clazz:Class<?>

The class to introspect

Returns:Method[]

the class methods as an array

getPropertyNameback to summary
public static String getPropertyName(Method setter)

Extract the Java Bean property name from the setter name.

Note

This method assumes that the method name has already been checked for correctness.

Parameters
setter:Method

The setter method

Returns:String

the bean property name

isValidLifecycleCallbackback to summary
public static boolean isValidLifecycleCallback(Method method)

Determines if a method is a valid lifecycle callback method.

Parameters
method:Method

The method to test

Returns:boolean

true if the method is a valid lifecycle callback method, else false

isValidSetterback to summary
public static boolean isValidSetter(Method method)

Determines if a method has a valid name and signature for a Java Bean setter.

Parameters
method:Method

The method to test

Returns:boolean

true if the method does have a valid name and signature, else false

loadClassback to summary
public static Class<?> loadClass(Context context, String className)

Attempt to load a class using the given Container's class loader. If the class cannot be loaded, a debug level log message will be written to the Container's log and null will be returned.

Parameters
context:Context

The class loader of this context will be used to attempt to load the class

className:String

The class name

Returns:Class<?>

the loaded class or null if loading failed