public class ReflectionUtil extends Object
Client code is not supposed to use this class.
Modifier and Type | Method and Description |
---|---|
static Map<String,Method> |
getGetters(Class<?> clazz)
Returns a Map of getter methods of the given class.
|
static Map<String,Method> |
getSetters(Class<?> clazz)
Returns a Map of setter methods of the given class.
|
static boolean |
isClassAvailable(String s)
Checks if the class is available on the current thread's context class loader.
|
static Object |
newInstance(String s)
Creates a new instance of the given class.
|
static String |
stripIllegalCharacters(String s)
Strips all illegal charaters from the given lower case string.
|
public static Map<String,Method> getGetters(Class<?> clazz)
The key of the map contains the name of the attribute that can be accessed by the getter, the value the getter itself (an instance of java.lang.reflect.Method). A method is considered a getter if its name starts with "get", it is declared public and takes no arguments.
clazz
- the class to return the getters forpublic static Map<String,Method> getSetters(Class<?> clazz)
The key of the map contains the name of the attribute that can be accessed by the setter, the value the setter itself (an instance of java.lang.reflect.Method). A method is considered a setter if its name starts with "set", it is declared public and takes exactly one argument.
clazz
- the class to return the setters forpublic static String stripIllegalCharacters(String s)
s
- the original stringpublic static boolean isClassAvailable(String s)
s
- fully qualified name of the class to check.true
if the class is available, false
otherwise.public static Object newInstance(String s)
s
- fully qualified name of the class to instantiate.null
on failure.Copyright © 2004–2017. All rights reserved.