Errai 3.0.1-SNAPSHOT

org.jboss.errai.common.client.api.interceptor
Class RemoteCallContext

java.lang.Object
  extended by org.jboss.errai.common.client.api.interceptor.RemoteCallContext
Direct Known Subclasses:
RestCallContext

public abstract class RemoteCallContext
extends Object

Represents the context of an intercepted remote call.

Author:
Christian Sadilek

Constructor Summary
RemoteCallContext()
           
 
Method Summary
abstract  Annotation[] getAnnotations()
          Returns the annotations of the intercepted method.
abstract  String getMethodName()
          Returns the name of the intercepted method.
 Object[] getParameters()
          Provides access to the intercepted method's parameters.
 Object getResult()
          Returns the result of the intercepted remote call.
abstract  Annotation[] getTypeAnnotations()
          Get the annotations of the intercepted type.
abstract  Object proceed()
          Proceeds to the next interceptor in the chain or with the execution of the intercepted method if all interceptors have been executed.
abstract  void proceed(RemoteCallback<?> callback)
          Proceeds to the next interceptor in the chain or with the execution of the intercepted method if all interceptors have been executed.
abstract  void proceed(RemoteCallback<?> callback, ErrorCallback<?> errorCallback)
          Proceeds to the next interceptor in the chain or with the execution of the intercepted method if all interceptors have been executed.
 void setParameters(Object[] parameters)
          Overrides the parameters that are passed to the method for which the interceptor was invoked.
 void setResult(Object result)
          Sets the result of the intercepted remote call.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RemoteCallContext

public RemoteCallContext()
Method Detail

getResult

public Object getResult()
Returns the result of the intercepted remote call.

Returns:
intercepted method result

setResult

public void setResult(Object result)
Sets the result of the intercepted remote call.

Parameters:
result - The result to return to the caller of the intercepted method.

proceed

public abstract void proceed(RemoteCallback<?> callback)
Proceeds to the next interceptor in the chain or with the execution of the intercepted method if all interceptors have been executed.

Parameters:
callback - The remote callback that receives the return value from the call. This callback is guaranteed to be invoked before the callback provided on the actual call site. Cannot be null.

proceed

public abstract void proceed(RemoteCallback<?> callback,
                             ErrorCallback<?> errorCallback)
Proceeds to the next interceptor in the chain or with the execution of the intercepted method if all interceptors have been executed.

Parameters:
callback - The remote callback that receives the return value from the call. This callback is guaranteed to be invoked before the callback provided on the actual call site. Cannot be null.
errorCallback - The error callback that receives transmission errors and exceptions thrown by the remote service. This error callback is guaranteed to be invoked before the error callback provided on the actual call site. Cannot be null.

getParameters

public Object[] getParameters()
Provides access to the intercepted method's parameters.

Returns:
Array of method parameters in declaration order. An empty array if the intercepted method has no parameters.

setParameters

public void setParameters(Object[] parameters)
Overrides the parameters that are passed to the method for which the interceptor was invoked.

Parameters:
parameters - the parameters to use when invoking the intercepted method. Must not be null.

getMethodName

public abstract String getMethodName()
Returns the name of the intercepted method.

Returns:
the name of the method for which the interceptor was invoked.

getAnnotations

public abstract Annotation[] getAnnotations()
Returns the annotations of the intercepted method.

Returns:
the annotations of the method of which the interceptor was invoked.

getTypeAnnotations

public abstract Annotation[] getTypeAnnotations()
Get the annotations of the intercepted type.

Returns:
the annotations of the type on which the interceptor was invoked.

proceed

public abstract Object proceed()
Proceeds to the next interceptor in the chain or with the execution of the intercepted method if all interceptors have been executed.

This method can also be called to proceed with an asynchronous call (e.g. when intercepting a remote procedure call), but only if the call's result is not required in the interceptor logic. If access to the result of an asynchronous method call is needed in the interceptor, one of the overloaded versions of this method accepting a RemoteCallback has to be used instead.

Returns:
the return value of the intercepted method. Always null for asynchronous methods.

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.