com.google.web.bindery.requestfactory.shared

## 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 Summary

    Constructors
    Constructor and Description
    `FanoutReceiver()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(Receiver<? super T> receiver)` Register a receiver to be called by the fanout.
    `protected void` | `finish()` Called after all Receivers have been executed.
    `void` | `onConstraintViolation(java.util.Set<ConstraintViolation<?>> violations)` Called if an object sent to the server could not be validated.
    `void` | `onFailure(ServerFailure error)` Receives general failure notifications.
    `void` | `onSuccess(T response)` Called when a Request has been successfully executed on the server.
    `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.
    `void` | `onViolation(java.util.Set<Violation> errors)` Deprecated.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### FanoutReceiver

          public FanoutReceiver()

  - ### Method Detail

    - #### add

          public void add(Receiver<? super T> receiver)

      Register a receiver to be called by the fanout.
      Throws:
        `java.lang.IllegalArgumentException` - if `receiver` is `null`

    - #### onConstraintViolation

          public void onConstraintViolation(java.util.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(java.util.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(java.lang.Throwable t)

      Subclasses may override this method to alter how the FanoutReceiver collects exceptions that escape from the queued Receivers.