Package spoon.support.util
Class RtHelper
java.lang.Object
spoon.support.util.RtHelper
This class is a helper for runtime reflection.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Collection<CtExecutableReference<?>>
getAllExecutables(Class<?> clazz, Factory factory)
return all executables of this classstatic Field[]
getAllFields(Class<?> c)
Gets all the runtime fields for a given class (including the superclasses and superinterfaces).static Collection<CtFieldReference<?>>
getAllFields(Class<?> c, Factory factory)
Gets all the field references for a given class (including the superclasses').static Method[]
getAllMethods(Class<?> c)
Gets all the runtime methods for a given class or interface (including the superclasses' or interfaces').static @Nullable Method
Looks for first public method of clazz (or any super class or super interface), whose name is equal to methodName and number of parameters is numParamsstatic Set<ModifierKind>
getModifiers(int mod)
Return the set of modifiers defined by the modifiers integer (java.lang.reflect).static <T> T
invoke(CtInvocation<T> i)
Actually invokes from a compile-time invocation (by using runtime reflection).
-
Method Details
-
getAllFields
Gets all the runtime fields for a given class (including the superclasses and superinterfaces). -
getAllFields
Gets all the field references for a given class (including the superclasses'). -
getAllMethods
Gets all the runtime methods for a given class or interface (including the superclasses' or interfaces'). -
invoke
public static <T> T invoke(CtInvocation<T> i) throws NoSuchMethodException, IllegalAccessException, InvocationTargetExceptionActually invokes from a compile-time invocation (by using runtime reflection). -
getModifiers
Return the set of modifiers defined by the modifiers integer (java.lang.reflect). -
getAllExecutables
public static Collection<CtExecutableReference<?>> getAllExecutables(Class<?> clazz, Factory factory)return all executables of this class -
getMethod
Looks for first public method of clazz (or any super class or super interface), whose name is equal to methodName and number of parameters is numParams- Parameters:
clazz
-methodName
-numParams
-- Returns:
- the found method or null
-