Package org.spockframework.util
Class ReflectionUtil
java.lang.Object
org.spockframework.util.ReflectionUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic File
getClassFile
(Class<?> clazz) Returns the class file for the given class (which has been verified to exist in the returned location), or null if the class file could not be found (e.g.static Method
getDeclaredMethodByName
(Class<?> clazz, String name) static Method
getDeclaredMethodBySignature
(Class<?> clazz, String name, Class<?>... parameterTypes) static Object
getDefaultValue
(Class<?> type) static Method
getMethodByName
(Class<?> clazz, String name) Finds a public method with the given name declared in the given class/interface or one of its super classes/interfaces.static Method
getMethodBySignature
(Class<?> clazz, String name, Class<?>... parameterTypes) static Class[]
static boolean
hasAnyOfTypes
(Object value, Class<?>... types) static Object
invokeMethod
(Object target, Method method, Object... args) static boolean
isAnnotationPresent
(AnnotatedElement element, String className) static boolean
isClassAvailable
(String className) static boolean
isMethodAvailable
(String className, String methodName) static Class<?>
loadClassIfAvailable
(String className)
-
Constructor Details
-
ReflectionUtil
public ReflectionUtil()
-
-
Method Details
-
loadClassIfAvailable
-
isClassAvailable
-
isMethodAvailable
-
isAnnotationPresent
-
getMethodByName
Finds a public method with the given name declared in the given class/interface or one of its super classes/interfaces. If multiple such methods exists, it is undefined which one is returned. -
getDeclaredMethodByName
-
getMethodBySignature
-
getDeclaredMethodBySignature
-
getClassFile
Returns the class file for the given class (which has been verified to exist in the returned location), or null if the class file could not be found (e.g. because it is contained in a Jar). -
getDefaultValue
-
hasAnyOfTypes
-
getTypes
-
invokeMethod
-