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 an UmbrellaException after all Receivers have been invoked.
  • Constructor Details

    • FanoutReceiver

      public FanoutReceiver()
  • Method Details

    • add

      public void add(Receiver<? super T> receiver)
      Register a receiver to be called by the fanout.
      Throws:
      IllegalArgumentException - if receiver is null
    • onConstraintViolation

      public void onConstraintViolation(Set<ConstraintViolation<?>> violations)
      Description copied from class: Receiver
      Called if an object sent to the server could not be validated. The default implementation calls Receiver.onViolation(Set), converting the ConstraintViolation objects to the deprecated Violation type.
      Overrides:
      onConstraintViolation in class Receiver<T>
      Parameters:
      violations - a Set of ConstraintViolation instances
    • onFailure

      public void onFailure(ServerFailure error)
      Description copied from class: Receiver
      Receives general failure notifications. The default implementation looks at ServerFailure.isFatal(), and throws a runtime exception with the failure object's error message if it is true.
      Overrides:
      onFailure in class Receiver<T>
      Parameters:
      error - a ServerFailure instance
    • onSuccess

      public void onSuccess(T response)
      Description copied from class: Receiver
      Called when a Request has been successfully executed on the server.
      Specified by:
      onSuccess in class Receiver<T>
      Parameters:
      response - a response of type V
    • onViolation

      @Deprecated public void onViolation(Set<Violation> errors)
      Deprecated.
      Description copied from class: Receiver
      Called if an object sent to the server could not be validated. The default implementation calls Receiver.onFailure(ServerFailure) if errors is not empty.
      Overrides:
      onViolation in class Receiver<T>
      Parameters:
      errors - a Set of Violation instances
    • finish

      protected void finish()
      Called after all Receivers have been executed.
    • onUncaughtThrowable

      protected void onUncaughtThrowable(Throwable t)
      Subclasses may override this method to alter how the FanoutReceiver collects exceptions that escape from the queued Receivers.