IT. Expert System.

Java Enterprise Edition (EE)

InvocationContext


javax.interceptor
Interface InvocationContext

public interface InvocationContext

Exposes context information about the intercepted invocation and operations that enable interceptor methods to control the behavior of the invocation chain.


    @AroundInvoke
    public Object logInvocation(InvocationContext ctx) throws Exception {
       String class = ctx.getMethod().getDeclaringClass().getName();
       String method = ctx.getMethod().getName();
       Logger.global.entering(class, method, ctx.getParameters());
       try {
          Object result = ctx.proceed();
          Logger.global.exiting(class, method, result);
          return result;
       }
       catch (Exception e) {
          Logger.global.throwing(class, method, e);
          throw e;
       }

    }
 
 

Method Summary
 java.util.Map<java.lang.String,java.lang.Object> getContextData()
          Returns the context data associated with this invocation or lifecycle callback.
 java.lang.reflect.Method getMethod()
          Returns the method of the target class for which the interceptor was invoked.
 java.lang.Object[] getParameters()
          Returns the parameter values that will be passed to the method of the target class.
 java.lang.Object getTarget()
          Returns the target instance.
 java.lang.Object getTimer()
          Returns the timer object associated with a timeout method invocation on the target class, or a null value for method and lifecycle callback interceptor methods.
 java.lang.Object proceed()
          Proceed to the next interceptor in the interceptor chain.
 void setParameters(java.lang.Object[] params)
          Sets the parameter values that will be passed to the method of the target class.
 

Method Detail

getTarget

java.lang.Object getTarget()
Returns the target instance.

Returns:
the target instance

getTimer

java.lang.Object getTimer()
Returns the timer object associated with a timeout method invocation on the target class, or a null value for method and lifecycle callback interceptor methods. For example, when associated with an EJB component timeout, this method returns Timer

Returns:
the timer object or a null value

getMethod

java.lang.reflect.Method getMethod()
Returns the method of the target class for which the interceptor was invoked. For method interceptors, the method of the target class is returned. For lifecycle callback interceptors, a null value is returned.

Returns:
the method, or a null value

getParameters

java.lang.Object[] getParameters()
Returns the parameter values that will be passed to the method of the target class. If setParameters() has been called, getParameters() returns the values to which the parameters have been set.

Returns:
the parameter values, as an array
Throws:
java.lang.IllegalStateException - if invoked within a lifecycle callback method.

setParameters

void setParameters(java.lang.Object[] params)
Sets the parameter values that will be passed to the method of the target class.

Parameters:
params - the parameter values, as an array
Throws:
java.lang.IllegalStateException - if invoked within a lifecycle callback method.
java.lang.IllegalArgumentException - if the types of the given parameter values do not match the types of the method parameters, or if the number of parameters supplied does not equal the number of method parameters.

getContextData

java.util.Map<java.lang.String,java.lang.Object> getContextData()
Returns the context data associated with this invocation or lifecycle callback. If there is no context data, an empty Map<String,Object> object will be returned.

Returns:
the context data, as a map

proceed

java.lang.Object proceed()
                         throws java.lang.Exception
Proceed to the next interceptor in the interceptor chain. Return the result of the next method invoked, or a null value if the method has return type void, return.

Returns:
the return value of the next method in the chain
Throws:
java.lang.Exception


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 1971 / . Delta: 0.02533 с