com.google.web.bindery.requestfactory.shared

## Class Receiver<V>

- java.lang.Object
- - com.google.web.bindery.requestfactory.shared.Receiver<V>

- Type Parameters:
    `V` - value type
  Direct Known Subclasses:
    FanoutReceiver

      public abstract class Receiver<V>
      extends java.lang.Object

  Callback object for `Request.fire(Receiver)` and `RequestContext.fire(Receiver)`.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Receiver()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `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.
    `abstract void` | `onSuccess(V response)` Called when a Request has been successfully executed on the server.
    `void` | `onViolation(java.util.Set<Violation> errors)` Deprecated. Use `onConstraintViolation(Set)` instead

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

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

- - ### Constructor Detail

    - #### Receiver

          public Receiver()

  - ### Method Detail

    - #### onFailure

          public void onFailure(ServerFailure error)

      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.
      Parameters:
        `error` - a `ServerFailure` instance

    - #### onSuccess

          public abstract void onSuccess(V response)

      Called when a Request has been successfully executed on the server.
      Parameters:
        `response` - a response of type V

    - #### onViolation

          @Deprecated
          public void onViolation(java.util.Set<Violation> errors)

      Deprecated. Use `onConstraintViolation(Set)` instead
      Called if an object sent to the server could not be validated. The default implementation calls `onFailure(ServerFailure)` if `errors` is not empty.
      Parameters:
        `errors` - a Set of `Violation` instances

    - #### onConstraintViolation

          public void onConstraintViolation(java.util.Set<ConstraintViolation<?>> violations)

      Called if an object sent to the server could not be validated. The default implementation calls `onViolation(Set)`, converting the `ConstraintViolation` objects to the deprecated `Violation` type.
      Parameters:
        `violations` - a Set of `ConstraintViolation` instances