Class RtHelper

java.lang.Object
spoon.support.util.RtHelper

public abstract class RtHelper extends Object
This class is a helper for runtime reflection.
  • Method Details

    • getAllFields

      public static Field[] getAllFields(Class<?> c)
      Gets all the runtime fields for a given class (including the superclasses and superinterfaces).
    • getAllFields

      public static Collection<CtFieldReference<?>> getAllFields(Class<?> c, Factory factory)
      Gets all the field references for a given class (including the superclasses').
    • getAllMethods

      public static Method[] getAllMethods(Class<?> c)
      Gets all the runtime methods for a given class or interface (including the superclasses' or interfaces').
    • invoke

      Actually invokes from a compile-time invocation (by using runtime reflection).
      Throws:
      NoSuchMethodException
      IllegalAccessException
      InvocationTargetException
    • getModifiers

      public static Set<ModifierKind> getModifiers(int mod)
      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

      public static @Nullable Method getMethod(Class<?> clazz, String methodName, int numParams)
      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