Package org.apache.tomcat.util
Class IntrospectionUtils
- java.lang.Object
-
- org.apache.tomcat.util.IntrospectionUtils
-
public final class IntrospectionUtils extends Object
Utils for introspection and reflection
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceIntrospectionUtils.PropertySource
-
Constructor Summary
Constructors Constructor Description IntrospectionUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ObjectcallMethod1(Object target, String methodN, Object param1, String typeParam1, ClassLoader cl)static ObjectcallMethodN(Object target, String methodN, Object[] params, Class<?>[] typeParams)static Stringcapitalize(String name)Reverse of Introspector.decapitalize.static voidclear()static Objectconvert(String object, Class<?> paramType)static MethodfindMethod(Class<?> c, String name, Class<?>[] params)static Method[]findMethods(Class<?> c)static ObjectgetProperty(Object o, String name)static StringreplaceProperties(String value, Hashtable<Object,Object> staticProp, IntrospectionUtils.PropertySource[] dynamicProp)Replace ${NAME} with the property value.static booleansetProperty(Object o, String name, String value)Find a method with the right name If found, call the method ( if param is int or boolean we'll convert value to the right type before) - that means you can have setDebug(1).static booleansetProperty(Object o, String name, String value, boolean invokeSetProperty)
-
-
-
Method Detail
-
setProperty
public static boolean setProperty(Object o, String name, String value)
Find a method with the right name If found, call the method ( if param is int or boolean we'll convert value to the right type before) - that means you can have setDebug(1).- Parameters:
o- The object to set a property onname- The property namevalue- The property value- Returns:
trueif operation was successful
-
setProperty
public static boolean setProperty(Object o, String name, String value, boolean invokeSetProperty)
-
replaceProperties
public static String replaceProperties(String value, Hashtable<Object,Object> staticProp, IntrospectionUtils.PropertySource[] dynamicProp)
Replace ${NAME} with the property value.- Parameters:
value- The valuestaticProp- Replacement propertiesdynamicProp- Replacement properties- Returns:
- the replacement value
-
capitalize
public static String capitalize(String name)
Reverse of Introspector.decapitalize.- Parameters:
name- The name- Returns:
- the capitalized string
-
clear
public static void clear()
-
callMethod1
public static Object callMethod1(Object target, String methodN, Object param1, String typeParam1, ClassLoader cl) throws Exception
- Throws:
Exception
-
callMethodN
public static Object callMethodN(Object target, String methodN, Object[] params, Class<?>[] typeParams) throws Exception
- Throws:
Exception
-
-