Class InterceptorContext

    • Constructor Detail

      • InterceptorContext

        public InterceptorContext()
    • Method Detail

      • getTarget

        public Object getTarget()
        Get the invocation target which is reported to the interceptor invocation context.
        Returns:
        the invocation target
      • setTarget

        public void setTarget​(Object target)
        Set the invocation target which is reported to the interceptor invocation context.
        Parameters:
        target - the invocation target
      • getMethod

        public Method getMethod()
        Get the invoked method which is reported to the interceptor invocation context.
        Returns:
        the method
      • setMethod

        public void setMethod​(Method method)
        Set the invoked method which is reported to the interceptor invocation context.
        Parameters:
        method - the method
      • getConstructor

        public Constructor<?> getConstructor()
        Get the intercepted constructor.
        Returns:
        the constructor
      • setConstructor

        public void setConstructor​(Constructor<?> constructor)
        Set the intercepted constructor.
        Parameters:
        constructor - the constructor
      • getParameters

        public Object[] getParameters()
        Get the method parameters which are reported to the interceptor invocation context.
        Returns:
        the method parameters
      • setParameters

        public void setParameters​(Object[] parameters)
        Set the method parameters which are reported to the interceptor invocation context.
        Parameters:
        parameters - the method parameters
      • setContextData

        public void setContextData​(Map<String,​Object> contextData)
        Set the context data which is reported to the interceptor invocation context.
        Parameters:
        contextData - the context data
      • getTimer

        public Object getTimer()
        Get the timer object which is reported to the interceptor invocation context.
        Returns:
        the timer object
      • setTimer

        public void setTimer​(Object timer)
        Set the timer object which is reported to the interceptor invocation context.
        Parameters:
        timer - the timer object
      • getInvocationContext

        public jakarta.interceptor.InvocationContext getInvocationContext()
        Get the invocation context.
        Returns:
        the invocation context
      • hasTransaction

        public boolean hasTransaction()
        Determine if a transaction supplier was established for this invocation.
        Returns:
        true if there is an enclosing transaction, false otherwise
      • getTransaction

        public jakarta.transaction.Transaction getTransaction()
                                                       throws jakarta.transaction.SystemException
        Get the transaction for this invocation, if any.
        Returns:
        the transaction for this invocation, or null if there is no transaction
        Throws:
        jakarta.transaction.SystemException - if the transaction import failed
      • setTransaction

        public void setTransaction​(jakarta.transaction.Transaction transaction)
        Set the transaction for the invocation. If null, then there is no enclosing transaction.
        Parameters:
        transaction - the transaction for the invocation
      • setTransactionSupplier

        public void setTransactionSupplier​(org.wildfly.common.function.ExceptionSupplier<jakarta.transaction.Transaction,​jakarta.transaction.SystemException> transactionSupplier)
        Set the transaction supplier for the invocation. If null, then there is no enclosing transaction. The supplier must not return null.
        Parameters:
        transactionSupplier - the transaction supplier, or null to clear the present transaction
      • getPrivateData

        public <T> T getPrivateData​(Class<T> type)
        Get a private data item.
        Type Parameters:
        T - the data type
        Parameters:
        type - the data type class object
        Returns:
        the data item or null if no such item exists
      • getPrivateData

        public Object getPrivateData​(Object key)
        Get a private data item. The key will be looked up by object identity, not by value.
        Parameters:
        key - the object key
        Returns:
        the private data object
      • putPrivateData

        public <T> T putPrivateData​(Class<T> type,
                                    T value)
        Insert a private data item.
        Type Parameters:
        T - the data type
        Parameters:
        type - the data type class object
        value - the data item value, or null to remove the mapping
        Returns:
        the data item which was previously mapped to this position, or null if no such item exists
      • putPrivateData

        public Object putPrivateData​(Object key,
                                     Object value)
        Insert a private data item. The key is used by object identity, not by value; in addition, if the key is a Class then the value given must be assignable to that class.
        Parameters:
        key - the data key
        value - the data item value, or null to remove the mapping
        Returns:
        the data item which was previously mapped to this position, or null if no such item exists
      • isBlockingCaller

        public boolean isBlockingCaller()
        Determine whether this invocation is currently directly blocking the calling thread. This means that the interceptor is running in the same thread as the original caller.
        Returns:
        true if the calling thread is being blocked; false otherwise
      • setBlockingCaller

        public void setBlockingCaller​(boolean blockingCaller)
        Establish whether this invocation is currently directly blocking the calling thread. This means that the interceptor is running in the same thread as the original caller.
        Parameters:
        blockingCaller - true if the calling thread is being blocked; false otherwise
      • getInterceptors

        public Interceptor[] getInterceptors()
        Get the current interceptors. The returned array should not be modified.
        Returns:
        the interceptors
      • getInterceptors$$bridge

        public List<Interceptor> getInterceptors$$bridge()
        Binary compatibility bridge for interceptors list.
        Returns:
        the interceptors array as a list
      • getNextInterceptorIndex

        public int getNextInterceptorIndex()
        Returns the next interceptor index.
        Returns:
        the next interceptor index
      • setInterceptors

        public void setInterceptors​(Interceptor[] interceptors)
        Set the interceptor iterator.
        Parameters:
        interceptors - the interceptor list
      • setInterceptors

        public void setInterceptors​(List<Interceptor> interceptorList)
        Set the interceptor array from a list.
        Parameters:
        interceptorList - the interceptor list
      • setInterceptors

        public void setInterceptors​(Interceptor[] interceptors,
                                    int nextIndex)
        Set the interceptors, with a starting index to proceed from.
        Parameters:
        interceptors - the interceptor array
        nextIndex - the next index to proceed
      • setInterceptors

        public void setInterceptors​(List<Interceptor> interceptorList,
                                    int nextIndex)
        Set the interceptors, with a starting index to proceed from.
        Parameters:
        interceptorList - the interceptor list
        nextIndex - the next index to proceed
      • proceed

        public Object proceed()
                       throws Exception
        Pass the invocation on to the next step in the chain.
        Returns:
        the result
        Throws:
        Exception - if an invocation throws an exception
      • clone

        public InterceptorContext clone()
        Clone this interceptor context instance. The cloned context will resume execution at the same point that this context would have at the moment it was cloned.
        Overrides:
        clone in class Object
        Returns:
        the copied context