public final class IntrospectionUtils extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
IntrospectionUtils.PropertySource |
static interface |
IntrospectionUtils.SecurePropertySource |
Constructor and Description |
---|
IntrospectionUtils() |
Modifier and Type | Method and Description |
---|---|
static Object |
callMethod1(Object target,
String methodN,
Object param1,
String typeParam1,
ClassLoader cl) |
static Object |
callMethodN(Object target,
String methodN,
Object[] params,
Class<?>[] typeParams) |
static String |
capitalize(String name)
Reverse of Introspector.decapitalize.
|
static void |
clear() |
static Object |
convert(String object,
Class<?> paramType) |
static String |
escape(String s) |
static Method |
findMethod(Class<?> c,
String name,
Class<?>[] params) |
static Method[] |
findMethods(Class<?> c) |
static Object |
getProperty(Object o,
String name) |
static boolean |
isInstance(Class<?> clazz,
String type)
Checks to see if the specified class is an instance of or assignable from
the specified type.
|
static String |
replaceProperties(String value,
Hashtable<Object,Object> staticProp,
IntrospectionUtils.PropertySource[] dynamicProp)
|
static String |
replaceProperties(String value,
Hashtable<Object,Object> staticProp,
IntrospectionUtils.PropertySource[] dynamicProp,
ClassLoader classLoader)
Replace ${NAME} with the property value.
|
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).
|
static boolean |
setProperty(Object o,
String name,
String value,
boolean invokeSetProperty) |
static boolean |
setProperty(Object o,
String name,
String value,
boolean invokeSetProperty,
StringBuilder actualMethod) |
public static boolean setProperty(Object o, String name, String value)
o
- The object to set a property onname
- The property namevalue
- The property valuetrue
if operation was successfulpublic static boolean setProperty(Object o, String name, String value, boolean invokeSetProperty)
public static boolean setProperty(Object o, String name, String value, boolean invokeSetProperty, StringBuilder actualMethod)
public static String escape(String s)
s
- the input string@Deprecated public static String replaceProperties(String value, Hashtable<Object,Object> staticProp, IntrospectionUtils.PropertySource[] dynamicProp)
value
- The valuestaticProp
- Replacement propertiesdynamicProp
- Replacement propertiespublic static String replaceProperties(String value, Hashtable<Object,Object> staticProp, IntrospectionUtils.PropertySource[] dynamicProp, ClassLoader classLoader)
value
- The valuestaticProp
- Replacement propertiesdynamicProp
- Replacement propertiesclassLoader
- Class loader associated with the code requesting the
propertypublic static String capitalize(String name)
name
- The namepublic static void clear()
public static Object callMethod1(Object target, String methodN, Object param1, String typeParam1, ClassLoader cl) throws Exception
Exception
public static Object callMethodN(Object target, String methodN, Object[] params, Class<?>[] typeParams) throws Exception
Exception
public static boolean isInstance(Class<?> clazz, String type)
clazz
, all its superclasses,
interfaces and those superinterfaces are tested for a match against
the type name type
.
This is similar to instanceof
or Class.isAssignableFrom(java.lang.Class<?>)
except that the target type will not be resolved into a Class
object, which provides some security and memory benefits.clazz
- The class to test for a match.type
- The name of the type that clazz
must be.true
if the clazz
tested is an
instance of the specified type
,
false
otherwise.Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.