public abstract class GsonNotificationCallback<T> extends JsonNotificationCallback<T>
Beta
A TypedNotificationCallback which uses an JSON content encoding with GsonFactory#getDefaultInstance().
Must NOT be implemented in form of an anonymous class as this will break serialization.
Implementation should be thread-safe. Example usage:
static class MyNotificationCallback
extends GsonNotificationCallback{@literal <}listresponse{@literal>} {
private static final long serialVersionUID = 1L;
{@literal @}Override
protected void onNotification(StoredChannel channel,
TypedNotification{@literal <}listresponse{@literal>} notification) {
ListResponse content = notification.getContent();
switch (notification.getResourceState()) {
case ResourceStates.SYNC:
break;
case ResourceStates.EXISTS:
break;
case ResourceStates.NOT_EXISTS:
break;
}
}
{@literal @}Override
protected Class{@literal <}listresponse{@literal>} getDataClass() throws IOException {
return ListResponse.class;
}
}
Inheritance
java.lang.Object > TypedNotificationCallback<T> > JsonNotificationCallback > GsonNotificationCallback<T>Type Parameter |
|
---|---|
Name | Description |
T |
Constructors
GsonNotificationCallback()
public GsonNotificationCallback()
Methods
getJsonFactory()
protected JsonFactory getJsonFactory()
Returns the JSON factory to use to parse the notification content.
Returns | |
---|---|
Type | Description |
com.google.api.client.json.JsonFactory |