Package org.spockframework.util
Class ReflectionUtil
java.lang.Object
org.spockframework.util.ReflectionUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioneraseTypes(List<Type> types) static FilegetClassFile(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 MethodgetDeclaredMethodByName(Class<?> clazz, String name) static MethodgetDeclaredMethodBySignature(Class<?> clazz, String name, Class<?>... parameterTypes) static ObjectgetDefaultValue(Class<?> type) static MethodgetMethodByName(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 MethodgetMethodBySignature(Class<?> clazz, String name, Class<?>... parameterTypes) static StringgetPackageName(Class<?> clazz) Determines the package name without callingClass.getPackage()(which may return null).static Class[]static booleanhasAnyOfTypes(Object value, Class<?>... types) static ObjectinvokeMethod(Object target, Method method, Object... args) static booleanisAnnotationPresent(AnnotatedElement element, String className) static booleanisClassAvailable(String className) static booleanisFinalMethod(Method method) static booleanisMethodAvailable(String className, String methodName) static Class<?> loadClassIfAvailable(String className)
-
Constructor Details
-
ReflectionUtil
public ReflectionUtil()
-
-
Method Details
-
getPackageName
Determines the package name without callingClass.getPackage()(which may return null). -
loadClassIfAvailable
-
isClassAvailable
-
isMethodAvailable
-
isAnnotationPresent
-
isFinalMethod
-
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
-
eraseTypes
-