R
- The response type which will be matched against and converted topublic class InstanceResponseType<R> extends AbstractResponseType<R>
ResponseType
implementation that will match with query handlers which return a single instance of the
expected response type. If matching succeeds, the ResponseType.convert(Object)
function will be called, which
will cast the query handler it's response to R
.expectedResponseType
MATCH, NO_MATCH
Constructor and Description |
---|
InstanceResponseType(Class<R> expectedResponseType)
Instantiate a
InstanceResponseType with the given expectedResponseType as the type to be matched
against and to which the query response should be converted to. |
Modifier and Type | Method and Description |
---|---|
R |
convert(Object response)
|
boolean |
matches(Type responseType)
Match the query handler its response
Type with this implementation its responseType
R . |
Class<R> |
responseMessagePayloadType()
Returns a
Class representing the type of the payload to be contained in the response message. |
String |
toString() |
equals, getExpectedResponseType, hashCode, isArray, isArrayOfExpectedType, isAssignableFrom, isGenericArrayOfExpectedType, isGenericArrayType, isGenericAssignableFrom, isIterableOfExpectedType, isParameterizedType, isParameterizedTypeOfExpectedType, isPublisherOfExpectedType, isStreamOfExpectedType, isTypeVariable, isWildcardType, isWildcardTypeWithMatchingUpperBound, projectReactorOnClassPath, unwrapIfTypeFuture
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
convertExceptional, forSerialization, matchRank
@ConstructorProperties(value="expectedResponseType") public InstanceResponseType(Class<R> expectedResponseType)
InstanceResponseType
with the given expectedResponseType
as the type to be matched
against and to which the query response should be converted to.expectedResponseType
- the response type which is expected to be matched against and returnedpublic boolean matches(Type responseType)
Type
with this implementation its responseType
R
.
Will return true if the expected type is assignable to the response type, taking generic types into account.responseType
- the response Type
of the query handler which is matched againstpublic R convert(Object response)
ResponseType
response
of type Object
into the type R
of this ResponseType
instance. Should only be called if ResponseType.matches(Type)
returns true. It is
unspecified what this function does if the ResponseType.matches(Type)
returned false.response
- the Object
to convert into R
response
of type R
public Class<R> responseMessagePayloadType()
ResponseType
Class
representing the type of the payload to be contained in the response message.Class
representing the type of the payload to be contained in the response messageCopyright © 2010–2023. All rights reserved.