Class RtHelper


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

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Collection<CtExecutableReference<?>> getAllExecutables​(java.lang.Class<?> clazz, Factory factory)
      return all executables of this class
      static java.lang.reflect.Field[] getAllFields​(java.lang.Class<?> c)
      Gets all the runtime fields for a given class (including the superclasses and superinterfaces).
      static java.util.Collection<CtFieldReference<?>> getAllFields​(java.lang.Class<?> c, Factory factory)
      Gets all the field references for a given class (including the superclasses').
      static java.lang.reflect.Method[] getAllMethods​(java.lang.Class<?> c)
      Gets all the runtime methods for a given class or interface (including the superclasses' or interfaces').
      static java.lang.reflect.Method getMethod​(java.lang.Class<?> clazz, java.lang.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
      static java.util.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).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getAllFields

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

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

        public static java.lang.reflect.Method[] getAllMethods​(java.lang.Class<?> c)
        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 java.lang.NoSuchMethodException,
                                   java.lang.IllegalAccessException,
                                   java.lang.reflect.InvocationTargetException
        Actually invokes from a compile-time invocation (by using runtime reflection).
        Throws:
        java.lang.NoSuchMethodException
        java.lang.IllegalAccessException
        java.lang.reflect.InvocationTargetException
      • getModifiers

        public static java.util.Set<ModifierKind> getModifiers​(int mod)
        Return the set of modifiers defined by the modifiers integer (java.lang.reflect).
      • getAllExecutables

        public static java.util.Collection<CtExecutableReference<?>> getAllExecutables​(java.lang.Class<?> clazz,
                                                                                       Factory factory)
        return all executables of this class
      • getMethod

        public static java.lang.reflect.Method getMethod​(java.lang.Class<?> clazz,
                                                         java.lang.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