public abstract class AdminCallback<T>
extends java.lang.Object
implements com.google.gwt.user.client.rpc.AsyncCallback<T>
AsyncCallback
and provides some extended features
on top - namely Admin specific error handling.Modifier and Type | Field and Description |
---|---|
private AdminServiceAsync |
adm
Reference to the admin service
|
private Alarm |
alarm
Reference to the alarm service
|
private java.lang.Throwable |
exception
An exception thrown during the call
|
private static java.util.logging.Logger |
log
Logger
|
private T |
result
Callback result
|
private java.util.List<java.lang.String> |
serverMessages
Server messages fetched from the backend on failure
|
Constructor and Description |
---|
AdminCallback()
A default ctor to satisfy GWT.
|
AdminCallback(AdminServiceAsync adm,
Alarm alarm)
Ctor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Throwable |
getException()
Returns the exception thrown during the backend call.
|
T |
getResult()
Returns the callback result.
|
java.util.List<java.lang.String> |
getServerMessages()
Returns messages fetched from the admin service on failure.
|
boolean |
isSuccess()
Returns
true when the call has finished and the result value is a success. |
abstract void |
onDone(T result)
Called when the service call has finished, regardless whether with success or failure.
|
void |
onFailure(java.lang.Throwable caught)
Called when an asynchronous call fails to complete normally.
|
void |
onSuccess(T result)
Called when an asynchronous call completes successfully.
|
private static final java.util.logging.Logger log
@Inject private AdminServiceAsync adm
@Inject private Alarm alarm
private T result
private java.lang.Throwable exception
private java.util.List<java.lang.String> serverMessages
public AdminCallback()
public AdminCallback(AdminServiceAsync adm, Alarm alarm)
adm
- Reference to the admin service.alarm
- Reference to the alarm service.public boolean isSuccess()
true
when the call has finished and the result value is a success.
"Is success" in this implementation means Boolean result value and result == true, but
this can be overridden by the extending classes.true
when the call has finished and the result value is a success,
false
otherwise.public T getResult()
public java.util.List<java.lang.String> getServerMessages()
public java.lang.Throwable getException()
null
if no exceptionpublic void onFailure(java.lang.Throwable caught)
IncompatibleRemoteServiceException
s, InvocationException
s,
or checked exceptions thrown by the service method are examples of the type
of failures that can be passed to this method.
If caught
is an instance of an
IncompatibleRemoteServiceException
the application should try to
get into a state where a browser refresh can be safely done.
onFailure
in interface com.google.gwt.user.client.rpc.AsyncCallback<T>
caught
- failure encountered while executing a remote procedure callpublic void onSuccess(T result)
onSuccess
in interface com.google.gwt.user.client.rpc.AsyncCallback<T>
result
- the return value of the remote produced callpublic abstract void onDone(T result)
result
- The call result, null
when failure.