Class InstanceResponseType<R>
java.lang.Object
org.axonframework.messaging.responsetypes.AbstractResponseType<R>
org.axonframework.messaging.responsetypes.InstanceResponseType<R>
- Type Parameters:
R- The response type which will be matched against and converted to
- All Implemented Interfaces:
Serializable,ResponseType<R>
A
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.- Since:
- 3.2
- Author:
- Steven van Beelen
- See Also:
-
Field Summary
Fields inherited from class org.axonframework.messaging.responsetypes.AbstractResponseType
expectedResponseTypeFields inherited from interface org.axonframework.messaging.responsetypes.ResponseType
MATCH, NO_MATCH -
Constructor Summary
ConstructorsConstructorDescriptionInstanceResponseType(Class<R> expectedResponseType) Instantiate aInstanceResponseTypewith the givenexpectedResponseTypeas the type to be matched against and to which the query response should be converted to. -
Method Summary
Methods inherited from class org.axonframework.messaging.responsetypes.AbstractResponseType
equals, getExpectedResponseType, hashCode, isArray, isArrayOfExpectedType, isAssignableFrom, isGenericArrayOfExpectedType, isGenericArrayType, isGenericAssignableFrom, isIterableOfExpectedType, isParameterizedType, isParameterizedTypeOfExpectedType, isPublisherOfExpectedType, isStreamOfExpectedType, isTypeVariable, isWildcardType, isWildcardTypeWithMatchingUpperBound, projectReactorOnClassPath, unwrapIfTypeFutureMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.axonframework.messaging.responsetypes.ResponseType
convertExceptional, forSerialization, matchRank
-
Constructor Details
-
InstanceResponseType
@ConstructorProperties("expectedResponseType") public InstanceResponseType(Class<R> expectedResponseType) Instantiate aInstanceResponseTypewith the givenexpectedResponseTypeas the type to be matched against and to which the query response should be converted to.- Parameters:
expectedResponseType- the response type which is expected to be matched against and returned
-
-
Method Details
-
matches
Match the query handler its responseTypewith this implementation its responseTypeR. Will return true if the expected type is assignable to the response type, taking generic types into account.- Parameters:
responseType- the responseTypeof the query handler which is matched against- Returns:
- true if the response type is assignable to the expected type, taking generic types into account
-
convert
Description copied from interface:ResponseTypeConverts the givenresponseof typeObjectinto the typeRof thisResponseTypeinstance. Should only be called ifResponseType.matches(Type)returns true. It is unspecified what this function does if theResponseType.matches(Type)returned false.- Parameters:
response- theObjectto convert intoR- Returns:
- a
responseof typeR
-
responseMessagePayloadType
Description copied from interface:ResponseTypeReturns aClassrepresenting the type of the payload to be contained in the response message.- Returns:
- a
Classrepresenting the type of the payload to be contained in the response message
-
toString
-