001/*
002 * Copyright 2002-2018 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.messaging.handler.invocation.reactive;
018
019import reactor.core.publisher.Mono;
020
021import org.springframework.core.MethodParameter;
022import org.springframework.messaging.Message;
023
024/**
025 * Strategy interface for resolving method parameters into argument values
026 * in the context of a given {@link Message}.
027 *
028 * @author Rossen Stoyanchev
029 * @since 5.2
030 */
031public interface HandlerMethodArgumentResolver {
032
033        /**
034         * Whether the given {@linkplain MethodParameter method parameter} is
035         * supported by this resolver.
036         * @param parameter the method parameter to check
037         * @return {@code true} if this resolver supports the supplied parameter;
038         * {@code false} otherwise
039         */
040        boolean supportsParameter(MethodParameter parameter);
041
042        /**
043         * Resolves a method parameter into an argument value from a given message.
044         * @param parameter the method parameter to resolve.
045         * This parameter must have previously been passed to
046         * {@link #supportsParameter(org.springframework.core.MethodParameter)}
047         * which must have returned {@code true}.
048         * @param message the currently processed message
049         * @return {@code Mono} for the argument value, possibly empty
050         */
051        Mono<Object> resolveArgument(MethodParameter parameter, Message<?> message);
052
053}