F
- The type for the converted Reply
.public abstract class AbstractReplyCallback<F> extends AbstractValidatingReplyCallback
Reply
message
into a different type of result.ERROR_CODE_FIELD, ERROR_MESSAGE_FIELDS
Constructor and Description |
---|
AbstractReplyCallback(Callback<F> forwardCallback)
Create a new AbstractReplyCallback.
|
Modifier and Type | Method and Description |
---|---|
protected abstract F |
convert(Reply reply)
Converts the
Reply into the final response type. |
void |
exception(Throwable thrown)
Called when the operation fails due to an exception.
|
Callback<F> |
getForwardCallback()
Returns the forwardCallback value.
|
protected void |
handle(Reply reply)
Called once the
Reply has been validated. |
boolean |
isLightWeight()
Returns true if the callback is lightweight and can be safely performed
in the receive thread.
|
asError, asError, asError, asError, asString, callback, checkForError, toInt, verify
public void exception(Throwable thrown)
Overridden to forward the exception to the myForwardCallback
.
exception
in interface Callback<Reply>
exception
in class AbstractValidatingReplyCallback
thrown
- The thrown exception.Callback.exception(java.lang.Throwable)
public Callback<F> getForwardCallback()
public boolean isLightWeight()
Overridden to return true if the forwardCallback
is a FutureCallback
or to forward the call if
the forwardCallback
is a ReplyCallback
.
protected abstract F convert(Reply reply) throws MongoDbException
Reply
into the final response type.reply
- The reply to convert.MongoDbException
- On a failure converting the reply. Generally, the
AbstractValidatingReplyCallback.verify(Reply)
method should be used to report
errors.protected void handle(Reply reply)
Reply
has been validated.
Overriden to convert
and then pass the converted
reply to the forward callback
.
handle
in class AbstractValidatingReplyCallback
reply
- The Reply
to be handled.Copyright © 2011–2014 Allanbank Consulting, Inc.. All rights reserved.