public class ReplyLongCallback extends AbstractReplyCallback<Long>
NumericElement and coerce it to a long value.| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_NAME
The default name for the long value to return.
|
ERROR_CODE_FIELD, ERROR_MESSAGE_FIELDS| Constructor and Description |
|---|
ReplyLongCallback(Callback<Long> results)
Create a new ReplyLongCallback.
|
ReplyLongCallback(String name,
Callback<Long> results)
Create a new ReplyLongCallback.
|
| Modifier and Type | Method and Description |
|---|---|
protected MongoDbException |
asError(Reply reply)
Creates an exception from the
Reply. |
protected Long |
convert(Reply reply)
Converts the
Reply into the final response type. |
protected long |
toLong(Element element)
Converts a
NumericElement into a long value. |
exception, getForwardCallback, handle, isLightWeightasError, asError, asError, asString, callback, checkForError, toInt, verifypublic static final String DEFAULT_NAME
public ReplyLongCallback(Callback<Long> results)
results - The callback to notify of the value.protected MongoDbException asError(Reply reply)
Reply.
Creates an exception from the Reply if the 'n' field is missing.
asError in class AbstractValidatingReplyCallbackreply - The raw reply.protected Long convert(Reply reply) throws MongoDbException
Reply into the final response type.
Overridden to return the 'n' field in the reply document.
convert in class AbstractReplyCallback<Long>reply - The reply to convert.MongoDbException - On a failure converting the reply. Generally, the
AbstractValidatingReplyCallback.verify(Reply) method should be used to report
errors.AbstractReplyCallback.convert(Reply)protected long toLong(Element element)
NumericElement into a long value. If not a
NumericElement then -1 is returned.element - The element to convert.Copyright © 2011–2014 Allanbank Consulting, Inc.. All rights reserved.