001/* 002 * Copyright 2002-2015 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; 018 019import org.springframework.core.MethodParameter; 020import org.springframework.messaging.Message; 021 022/** 023 * Strategy interface for resolving method parameters into argument values 024 * in the context of a given {@link Message}. 025 * 026 * @author Rossen Stoyanchev 027 * @since 4.0 028 */ 029public interface HandlerMethodArgumentResolver { 030 031 /** 032 * Whether the given {@linkplain MethodParameter method parameter} is 033 * supported by this resolver. 034 * @param parameter the method parameter to check 035 * @return {@code true} if this resolver supports the supplied parameter; 036 * {@code false} otherwise 037 */ 038 boolean supportsParameter(MethodParameter parameter); 039 040 /** 041 * Resolves a method parameter into an argument value from a given message. 042 * @param parameter the method parameter to resolve. 043 * This parameter must have previously been passed to 044 * {@link #supportsParameter(org.springframework.core.MethodParameter)} 045 * which must have returned {@code true}. 046 * @param message the currently processed message 047 * @return the resolved argument value, or {@code null} 048 * @throws Exception in case of errors with the preparation of argument values 049 */ 050 Object resolveArgument(MethodParameter parameter, Message<?> message) throws Exception; 051 052}