Class UberspectImpl.VelMethodImpl

  • All Implemented Interfaces:
    VelMethod
    Enclosing class:
    UberspectImpl

    public static class UberspectImpl.VelMethodImpl
    extends java.lang.Object
    implements VelMethod
    Implementation of VelMethod
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) Converter<?>[] converters  
      (package private) java.lang.Boolean isVarArg  
      (package private) java.lang.reflect.Method method  
      (package private) boolean wrapArray  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private VelMethodImpl()  
        VelMethodImpl​(java.lang.reflect.Method m)  
        VelMethodImpl​(java.lang.reflect.Method method, boolean wrapArray)  
        VelMethodImpl​(java.lang.reflect.Method method, boolean wrapArray, Converter<?>[] converters)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.Object doInvoke​(java.lang.Object o, java.lang.Object[] actual)
      Offers an extension point for subclasses (in alternate Uberspects) to alter the invocation after any array wrapping or varargs handling has already been completed.
      java.lang.reflect.Method getMethod()
      returns the underlying Method
      java.lang.String getMethodName()
      returns the method name used
      java.lang.Class<?> getReturnType()
      returns the return type of the method invoked
      private java.lang.Object[] handleVarArg​(java.lang.Class<?> type, int index, java.lang.Object[] actual)  
      java.lang.Object invoke​(java.lang.Object o, java.lang.Object[] actual)
      invocation method - called when the method invocation should be performed and a value returned
      boolean isCacheable()
      specifies if this VelMethod is cacheable and able to be reused for this class of object it was returned for
      boolean isVarArg()  
      • Methods inherited from class java.lang.Object

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

      • method

        final java.lang.reflect.Method method
      • isVarArg

        java.lang.Boolean isVarArg
      • wrapArray

        boolean wrapArray
    • Constructor Detail

      • VelMethodImpl

        public VelMethodImpl​(java.lang.reflect.Method m)
        Parameters:
        m -
      • VelMethodImpl

        public VelMethodImpl​(java.lang.reflect.Method method,
                             boolean wrapArray)
        Parameters:
        method -
        wrapArray -
        Since:
        1.6
      • VelMethodImpl

        public VelMethodImpl​(java.lang.reflect.Method method,
                             boolean wrapArray,
                             Converter<?>[] converters)
        Parameters:
        method -
        wrapArray -
        converters -
        Since:
        2.0
      • VelMethodImpl

        private VelMethodImpl()
    • Method Detail

      • invoke

        public java.lang.Object invoke​(java.lang.Object o,
                                       java.lang.Object[] actual)
                                throws java.lang.IllegalAccessException,
                                       java.lang.reflect.InvocationTargetException
        Description copied from interface: VelMethod
        invocation method - called when the method invocation should be performed and a value returned
        Specified by:
        invoke in interface VelMethod
        Parameters:
        o -
        actual -
        Returns:
        invocation result
        Throws:
        java.lang.IllegalAccessException
        java.lang.reflect.InvocationTargetException
        See Also:
        VelMethod.invoke(java.lang.Object, java.lang.Object[])
      • doInvoke

        protected java.lang.Object doInvoke​(java.lang.Object o,
                                            java.lang.Object[] actual)
                                     throws java.lang.IllegalAccessException,
                                            java.lang.reflect.InvocationTargetException
        Offers an extension point for subclasses (in alternate Uberspects) to alter the invocation after any array wrapping or varargs handling has already been completed.
        Parameters:
        o - target object
        actual - arguments
        Returns:
        invocation result
        Throws:
        java.lang.IllegalAccessException
        java.lang.reflect.InvocationTargetException
        Since:
        1.6
      • isVarArg

        public boolean isVarArg()
        Returns:
        true if this method can accept a variable number of arguments
        Since:
        1.6
      • handleVarArg

        private java.lang.Object[] handleVarArg​(java.lang.Class<?> type,
                                                int index,
                                                java.lang.Object[] actual)
        Parameters:
        type - The vararg class type (aka component type of the expected array arg)
        index - The index of the vararg in the method declaration (This will always be one less than the number of expected arguments.)
        actual - The actual parameters being passed to this method
        Returns:
        The actual parameters adjusted for the varargs in order to fit the method declaration.
      • isCacheable

        public boolean isCacheable()
        Description copied from interface: VelMethod
        specifies if this VelMethod is cacheable and able to be reused for this class of object it was returned for
        Specified by:
        isCacheable in interface VelMethod
        Returns:
        true if can be reused for this class, false if not
        See Also:
        VelMethod.isCacheable()
      • getReturnType

        public java.lang.Class<?> getReturnType()
        Description copied from interface: VelMethod
        returns the return type of the method invoked
        Specified by:
        getReturnType in interface VelMethod
        Returns:
        The return type of the method invoked
        See Also:
        VelMethod.getReturnType()