Class SimpleInvocationContext

  • All Implemented Interfaces:
    jakarta.interceptor.InvocationContext

    public class SimpleInvocationContext
    extends Object
    implements jakarta.interceptor.InvocationContext
    A base class for invocation contexts. Also can act as the last interceptor in a chain which does not proceed.
    Author:
    David M. Lloyd
    • Constructor Detail

      • SimpleInvocationContext

        public SimpleInvocationContext​(Object target,
                                       Method method,
                                       Object[] parameters,
                                       Map<String,​Object> contextData,
                                       Object timer,
                                       Constructor<?> constructor)
        Construct a new instance.
        Parameters:
        target - the target object instance
        method - the invocation method (may be null)
        parameters - the invocation parameters (may be null)
        contextData - the context data map to use
        timer - the associated timer (may be null)
      • SimpleInvocationContext

        public SimpleInvocationContext​(Object target,
                                       Method method,
                                       Object[] parameters,
                                       Object timer)
        Construct a new instance.
        Parameters:
        target - the target object instance
        method - the invocation method (may be null)
        parameters - the invocation parameters (may be null)
        timer - the associated timer (may be null)
      • SimpleInvocationContext

        public SimpleInvocationContext​(Object target,
                                       Method method,
                                       Object[] parameters)
        Construct a new instance.
        Parameters:
        target - the target object instance
        method - the invocation method (may be null)
        parameters - the invocation parameters (may be null)
    • Method Detail

      • getTarget

        public Object getTarget()
        Specified by:
        getTarget in interface jakarta.interceptor.InvocationContext
      • getMethod

        public Method getMethod()
        Specified by:
        getMethod in interface jakarta.interceptor.InvocationContext
      • getParameters

        public Object[] getParameters()
        Specified by:
        getParameters in interface jakarta.interceptor.InvocationContext
      • setParameters

        public void setParameters​(Object[] parameters)
        Specified by:
        setParameters in interface jakarta.interceptor.InvocationContext
      • getContextData

        public Map<String,​Object> getContextData()
        Specified by:
        getContextData in interface jakarta.interceptor.InvocationContext
      • getTimer

        public Object getTimer()
        Specified by:
        getTimer in interface jakarta.interceptor.InvocationContext
      • proceed

        public Object proceed()
                       throws Exception
        Throw an exception indicating that the end of the interceptor chain was reached without an invocation being performed. This method should be overridden to provide a specific implementation. Though this method always throws CannotProceedException, it is declared to throw Exception so that subclasses can override this method in a spec-compliant way.
        Specified by:
        proceed in interface jakarta.interceptor.InvocationContext
        Returns:
        nothing
        Throws:
        Exception - always (in particular, CannotProceedException)
      • getConstructor

        public Constructor<?> getConstructor()
        Specified by:
        getConstructor in interface jakarta.interceptor.InvocationContext