R
- a generic specifying the type of the QueryResponseMessage
public class GrpcBackedResponseMessage<R> extends Object implements QueryResponseMessage<R>
QueryResponse
as a QueryResponseMessage
.Constructor and Description |
---|
GrpcBackedResponseMessage(QueryResponse queryResponse,
Serializer serializer)
Instantiate a
GrpcBackedResponseMessage with the given queryResponse , using the provided
Serializer to be able to retrieve the payload and MetaData from it. |
Modifier and Type | Method and Description |
---|---|
GrpcBackedResponseMessage<R> |
andMetaData(Map<String,?> metaData)
Returns a copy of this QueryResponseMessage with its MetaData merged with given
metaData . |
String |
getIdentifier()
Returns the identifier of this message.
|
MetaData |
getMetaData()
Returns the meta data for this event.
|
R |
getPayload()
Returns the payload of this Event.
|
Class<R> |
getPayloadType()
Returns the type of the payload.
|
boolean |
isExceptional()
Indicates whether the ResultMessage represents unsuccessful execution.
|
Optional<Throwable> |
optionalExceptionResult()
Returns the Exception in case of exceptional result message or an empty
Optional in case of successful
execution. |
GrpcBackedResponseMessage<R> |
withMetaData(Map<String,?> metaData)
Returns a copy of this QueryResponseMessage with the given
metaData . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
exceptionResult, serializeExceptionResult
serializeMetaData, serializePayload
public GrpcBackedResponseMessage(QueryResponse queryResponse, Serializer serializer)
GrpcBackedResponseMessage
with the given queryResponse
, using the provided
Serializer
to be able to retrieve the payload and MetaData
from it.queryResponse
- the QueryResponse
which is being wrapped as a QueryResponseMessage
serializer
- the Serializer
used to deserialize the payload and MetaData
from the given
queryResponse
public String getIdentifier()
Message
getIdentifier
in interface Message<R>
public MetaData getMetaData()
Message
getMetaData
in interface Message<R>
public R getPayload()
Message
getPayload
in interface Message<R>
public Class<R> getPayloadType()
Message
getPayload().getClass()
, but allows implementations to optimize by using
lazy loading or deserialization.getPayloadType
in interface Message<R>
public boolean isExceptional()
ResultMessage
isExceptional
in interface ResultMessage<R>
true
if execution was unsuccessful, false
otherwisepublic Optional<Throwable> optionalExceptionResult()
ResultMessage
Optional
in case of successful
execution.optionalExceptionResult
in interface ResultMessage<R>
Optional
containing exception result or an empty Optional in case of a successful executionpublic GrpcBackedResponseMessage<R> withMetaData(Map<String,?> metaData)
QueryResponseMessage
metaData
. The payload remains unchanged.withMetaData
in interface Message<R>
withMetaData
in interface ResultMessage<R>
withMetaData
in interface QueryResponseMessage<R>
metaData
- The new MetaData for the QueryResponseMessagepublic GrpcBackedResponseMessage<R> andMetaData(Map<String,?> metaData)
QueryResponseMessage
metaData
. The payload
remains unchanged.andMetaData
in interface Message<R>
andMetaData
in interface ResultMessage<R>
andMetaData
in interface QueryResponseMessage<R>
metaData
- The MetaData to merge into the QueryResponseMessageCopyright © 2010–2019. All rights reserved.