Class MethodInvocation<T>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.Object[] arguments  
      protected java.lang.reflect.Method method  
      protected java.util.Optional<java.lang.Object> target  
    • Constructor Summary

      Constructors 
      Constructor Description
      MethodInvocation​(java.lang.reflect.Method method, java.util.Optional<java.lang.Object> target, java.lang.Object[] arguments)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<java.lang.Object> getArguments()
      Get the arguments of the executable in this invocation context.
      java.lang.reflect.Method getExecutable()
      Get the method or constructor of this invocation context.
      java.util.Optional<java.lang.Object> getTarget()
      Get the target object of this invocation context, if available.
      java.lang.Class<?> getTargetClass()
      Get the target class of this invocation context.
      T proceed()
      Proceed with this invocation.
      • Methods inherited from class java.lang.Object

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

      • method

        protected final java.lang.reflect.Method method
      • target

        protected final java.util.Optional<java.lang.Object> target
      • arguments

        protected final java.lang.Object[] arguments
    • Constructor Detail

      • MethodInvocation

        MethodInvocation​(java.lang.reflect.Method method,
                         java.util.Optional<java.lang.Object> target,
                         java.lang.Object[] arguments)
    • Method Detail

      • getTargetClass

        public java.lang.Class<?> getTargetClass()
        Description copied from interface: ReflectiveInvocationContext
        Get the target class of this invocation context.

        If this invocation context represents an instance method, this method returns the class of the object the method will be invoked on, not the class it is declared in. Otherwise, if this invocation represents a static method or constructor, this method returns the class the method or constructor is declared in.

        Specified by:
        getTargetClass in interface ReflectiveInvocationContext<T>
        Returns:
        the target class of this invocation context; never null
      • getTarget

        public java.util.Optional<java.lang.Object> getTarget()
        Description copied from interface: ReflectiveInvocationContext
        Get the target object of this invocation context, if available.

        If this invocation context represents an instance method, this method returns the object the method will be invoked on. Otherwise, if this invocation context represents a static method or constructor, this method returns empty().

        Specified by:
        getTarget in interface ReflectiveInvocationContext<T>
        Returns:
        the target of the executable of this invocation context; never null but potentially empty
      • getArguments

        public java.util.List<java.lang.Object> getArguments()
        Description copied from interface: ReflectiveInvocationContext
        Get the arguments of the executable in this invocation context.
        Specified by:
        getArguments in interface ReflectiveInvocationContext<T>
        Returns:
        the arguments of the executable in this invocation context; immutable and never null