Class FanoutReceiver<T>
- java.lang.Object
-
- com.google.web.bindery.requestfactory.shared.Receiver<T>
-
- com.google.web.bindery.requestfactory.shared.FanoutReceiver<T>
-
- Type Parameters:
T- the type of data being received
public class FanoutReceiver<T> extends Receiver<T>
A FanoutReceiver will forward its callbacks to zero or more other Receivers. Any exceptions thrown by the queued Receivers will be re-thrown as anUmbrellaExceptionafter all Receivers have been invoked.
-
-
Constructor Summary
Constructors Constructor Description FanoutReceiver()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidadd(Receiver<? super T> receiver)Register a receiver to be called by the fanout.protected voidfinish()Called after all Receivers have been executed.voidonConstraintViolation(java.util.Set<ConstraintViolation<?>> violations)Called if an object sent to the server could not be validated.voidonFailure(ServerFailure error)Receives general failure notifications.voidonSuccess(T response)Called when a Request has been successfully executed on the server.protected voidonUncaughtThrowable(java.lang.Throwable t)Subclasses may override this method to alter how the FanoutReceiver collects exceptions that escape from the queued Receivers.voidonViolation(java.util.Set<Violation> errors)Deprecated.
-
-
-
Method Detail
-
add
public void add(Receiver<? super T> receiver)
Register a receiver to be called by the fanout.- Throws:
java.lang.IllegalArgumentException- ifreceiverisnull
-
onConstraintViolation
public void onConstraintViolation(java.util.Set<ConstraintViolation<?>> violations)
Description copied from class:ReceiverCalled if an object sent to the server could not be validated. The default implementation callsReceiver.onViolation(Set), converting theConstraintViolationobjects to the deprecatedViolationtype.- Overrides:
onConstraintViolationin classReceiver<T>- Parameters:
violations- a Set ofConstraintViolationinstances
-
onFailure
public void onFailure(ServerFailure error)
Description copied from class:ReceiverReceives general failure notifications. The default implementation looks atServerFailure.isFatal(), and throws a runtime exception with the failure object's error message if it is true.- Overrides:
onFailurein classReceiver<T>- Parameters:
error- aServerFailureinstance
-
onSuccess
public void onSuccess(T response)
Description copied from class:ReceiverCalled when a Request has been successfully executed on the server.
-
onViolation
@Deprecated public void onViolation(java.util.Set<Violation> errors)
Deprecated.Description copied from class:ReceiverCalled if an object sent to the server could not be validated. The default implementation callsReceiver.onFailure(ServerFailure)iferrorsis not empty.- Overrides:
onViolationin classReceiver<T>- Parameters:
errors- a Set ofViolationinstances
-
finish
protected void finish()
Called after all Receivers have been executed.
-
onUncaughtThrowable
protected void onUncaughtThrowable(java.lang.Throwable t)
Subclasses may override this method to alter how the FanoutReceiver collects exceptions that escape from the queued Receivers.
-
-