@@ -0,0 +1,2078 @@
+package org.axonframework.queryhandling;%0A%0Aimport java.lang.reflect.Type;%0A%0A/**%0A * Specifies the expected response type required when performing a query through the%0A * %7B@link org.axonframework.queryhandling.QueryBus%7D/%7B@link org.axonframework.queryhandling.QueryGateway%7D. It is%0A * generally thus required to provided an instance of %7B@link ResponseType%7D when performing a query.%0A * By wrapping the response type as a generic %7B@code T%7D, we can easily%0A * service that expected type as a single instance, a list, a page etc., based on the selected implementation.%0A * %3C/p%3E%0A * It is in charge of matching the response type of a query handler with the given generic %7B@code T%7D.%0A * If this match returns true, it signals the found query handler can handle the intended query.%0A * As a follow up, the response retrieved from a query handler should move through the convert function to guarantee the%0A * right response type is returned.%0A *%0A * @param %3CT%3E the generic type of this %7B@link ResponseType%7D to be matched and converted.%0A * @author Steven van Beelen%0A * @since 3.2%0A */%0Apublic interface ResponseType%3CT%3E %7B%0A%0A    /**%0A     * Match the query handler its response %7B@link java.lang.reflect.Type%7D with this response its type %7B@code T%7D.%0A     * Will return true if a response can be converted based on the given %7B@code type%7D and false if it cannot.%0A     *%0A     * @param type the response %7B@link java.lang.reflect.Type%7D of the query handler which is matched against%0A     * @return true if a response can be converted based on the given %7B@code type%7D and false if it cannot%0A     */%0A    boolean matches(Type type);%0A%0A    /**%0A     * Converts the given %7B@code response%7D of type %7B@link java.lang.Object%7D into the type %7B@code T%7D of this%0A     * %7B@link ResponseType%7D instance. Should only be called if %7B@link ResponseType#matches(Type)%7D returns true.%0A     *%0A     * @param response the %7B@link java.lang.Object%7D to convert into %7B@code T%7D%0A     * @return a %7B@code response%7D of type %7B@code T%7D%0A     */%0A    @SuppressWarnings(%22unchecked%22)%0A    default T convert(Object response) %7B%0A        return (T) response;%0A    %7D%0A%7D%0A

Introduce the ResponseType interface