Class ResponseTypes
java.lang.Object
org.axonframework.messaging.responsetypes.ResponseTypes
Utility class containing static methods to obtain instances of
ResponseType.- Since:
- 3.2
- Author:
- Steven van Beelen
-
Method Summary
Modifier and TypeMethodDescriptionstatic <R> ResponseType<R> instanceOf(Class<R> type) Specify the desire to retrieve a single instance of typeRwhen performing a query.static <R> ResponseType<List<R>> multipleInstancesOf(Class<R> type) Specify the desire to retrieve a collection of instances of typeRwhen performing a query.static <R> ResponseType<Optional<R>> optionalInstanceOf(Class<R> type) Specify the desire to retrieve anOptional<R>when performing a query.static <R> ResponseType<org.reactivestreams.Publisher<R>> publisherOf(Class<R> type) Specify the desire to retrieve a Publisher (reactive stream) of instances of typeRwhen performing a query.
-
Method Details
-
instanceOf
Specify the desire to retrieve a single instance of typeRwhen performing a query.- Type Parameters:
R- the generic type of the instantiatedResponseType- Parameters:
type- theRwhich is expected to be the response type- Returns:
- a
ResponseTypespecifying the desire to retrieve a single instance of typeR
-
optionalInstanceOf
Specify the desire to retrieve anOptional<R>when performing a query.Note that this
ResponseTypewill declare the same expectations on the Query Result as theResponseTypereturned byinstanceOf(Class). The difference is that the result provided by thisResponseTypeis wrapped in anOptional.- Type Parameters:
R- the generic type of the instantiatedResponseType- Parameters:
type- theRwhich is expected to be the response type- Returns:
- a
ResponseTypespecifying the desire to retrieve an optional instance of typeR
-
multipleInstancesOf
Specify the desire to retrieve a collection of instances of typeRwhen performing a query. If no handler is found that can retrieve the type as a collection, a handler is selected that returns a single instance of the provided type.- Type Parameters:
R- the generic type of the instantiatedResponseType- Parameters:
type- theRwhich is expected to be the response type- Returns:
- a
ResponseTypespecifying the desire to retrieve a collection of instances of typeR
-
publisherOf
Specify the desire to retrieve a Publisher (reactive stream) of instances of typeRwhen performing a query.- Type Parameters:
R- the generic type of the instantiatedResponseType- Parameters:
type- theRwhich is expected to be the response type- Returns:
- a
ResponseTypespecifying the desire to retrieve a publisher of instances of typeR
-