Package org.camunda.bpm.engine.impl.util
Class ReflectUtil
java.lang.Object
org.camunda.bpm.engine.impl.util.ReflectUtil
- Author:
- Tom Baeyens
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TcreateInstance(Class<? extends T> clazz) static ClassLoaderstatic FieldReturns the field of the given class or null if it doesnt exist.static FieldReturns the field of the given object or null if it doesnt exist.static MethodFinds a method by name and parameter types.static URLgetResource(String name) static InputStreamgetResourceAsStream(String name) static StringgetResourceUrlAsString(String name) static MethodReturns the setter-method for the given field name or null if no setter exists.static MethodgetSingleSetter(String fieldName, Class<?> clazz) Returns a setter method based on the fieldName and the java beans setter naming convention or null if none exists.static <T> Tinstantiate(Class<T> type) static Objectinstantiate(String className) static Objectinstantiate(String className, Object[] args) static Objectstatic Class<?>static <T> Class<? extends T>loadClass(String className, ClassLoader customClassloader, Class<T> clazz) static voidstatic URIConverts an url to an uri.
-
Constructor Details
-
ReflectUtil
public ReflectUtil()
-
-
Method Details
-
getClassLoader
-
loadClass
-
loadClass
public static <T> Class<? extends T> loadClass(String className, ClassLoader customClassloader, Class<T> clazz) throws ClassNotFoundException, ClassCastException -
getResourceAsStream
-
getResource
-
getResourceUrlAsString
-
urlToURI
Converts an url to an uri. Escapes whitespaces if needed.- Parameters:
url- the url to convert- Returns:
- the resulting uri
- Throws:
ProcessEngineException- if the url has invalid syntax
-
instantiate
-
instantiate
-
createInstance
-
invoke
-
getField
Returns the field of the given object or null if it doesnt exist. -
getField
Returns the field of the given class or null if it doesnt exist. -
setField
-
getSetter
Returns the setter-method for the given field name or null if no setter exists. -
getSingleSetter
Returns a setter method based on the fieldName and the java beans setter naming convention or null if none exists. If multiple setters with different parameter types are present, an exception is thrown. If they have the same parameter type, one of those methods is returned. -
instantiate
-
getMethod
public static Method getMethod(Class<?> declaringType, String methodName, Class<?>... parameterTypes) Finds a method by name and parameter types.- Parameters:
declaringType- the name of the classmethodName- the name of the method to look forparameterTypes- the types of the parameters
-