Class RMMethodUtils


  • public class RMMethodUtils
    extends java.lang.Object
    Utility methods for method reflection.
    • Constructor Summary

      Constructors 
      Constructor Description
      RMMethodUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.reflect.Method getMethod​(java.lang.Object anObj, java.lang.String aMethod, java.lang.Class... parameterTypes)
      Returns the method for the given object, method name and paramter types class array.
      static java.lang.Object invoke​(java.lang.Object anObj, java.lang.reflect.Method aMethod, java.lang.Object... parameters)
      Calls the given method name on the given object with the given arg array and class array.
      static java.lang.Object invoke​(java.lang.Object anObj, java.lang.String aMethod)
      Calls the given method name on the given object.
      static java.lang.Object invoke​(java.lang.Object anObj, java.lang.String aMethod, java.lang.Object[] parameters, java.lang.Class[] parameterTypes)
      Calls the given method name on the given object with the given arg array and class array.
      static java.lang.Object invoke​(java.lang.Object anObj, java.lang.String aMethod, java.lang.Object aValue, java.lang.Class parameterType)
      Calls the given method name on the given object with the given parameter of the given class.
      static void invokeAll​(java.util.List targets, java.lang.String aMethod, java.lang.Object aValue, java.lang.Class aClass)
      Invokes a given method on every member of a List.
      • Methods inherited from class java.lang.Object

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

      • RMMethodUtils

        public RMMethodUtils()
    • Method Detail

      • getMethod

        public static java.lang.reflect.Method getMethod​(java.lang.Object anObj,
                                                         java.lang.String aMethod,
                                                         java.lang.Class... parameterTypes)
        Returns the method for the given object, method name and paramter types class array.
      • invoke

        public static java.lang.Object invoke​(java.lang.Object anObj,
                                              java.lang.String aMethod)
        Calls the given method name on the given object.
      • invoke

        public static java.lang.Object invoke​(java.lang.Object anObj,
                                              java.lang.String aMethod,
                                              java.lang.Object aValue,
                                              java.lang.Class parameterType)
        Calls the given method name on the given object with the given parameter of the given class.
      • invoke

        public static java.lang.Object invoke​(java.lang.Object anObj,
                                              java.lang.String aMethod,
                                              java.lang.Object[] parameters,
                                              java.lang.Class[] parameterTypes)
        Calls the given method name on the given object with the given arg array and class array.
      • invoke

        public static java.lang.Object invoke​(java.lang.Object anObj,
                                              java.lang.reflect.Method aMethod,
                                              java.lang.Object... parameters)
        Calls the given method name on the given object with the given arg array and class array.
      • invokeAll

        public static void invokeAll​(java.util.List targets,
                                     java.lang.String aMethod,
                                     java.lang.Object aValue,
                                     java.lang.Class aClass)
        Invokes a given method on every member of a List. Any method not implemented by the object is simply ignored - invoke() returns null if the class doesn't have the method. The method's return values are also ignored (this isn't aggregation, just invocation).