View Javadoc

1   /*
2    * Copyright 2005-2010 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.springframework.ws.server.endpoint.adapter.method;
18  
19  import org.springframework.core.MethodParameter;
20  import org.springframework.ws.context.MessageContext;
21  
22  /**
23   * Strategy interface used to resolve method parameters into arguments. This interface is used to allow the {@link
24   * org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapter DefaultMethodEndpointAdapter} to be
25   * indefinitely extensible.
26   *
27   * @author Arjen Poutsma
28   * @since 2.0
29   */
30  public interface MethodArgumentResolver {
31  
32      /**
33       * Indicates whether the given {@linkplain MethodParameter method parameter} is supported by this resolver.
34       *
35       * @param parameter the method parameter to check
36       * @return {@code true} if this resolver supports the supplied parameter; {@code false} otherwise
37       */
38      boolean supportsParameter(MethodParameter parameter);
39  
40      /**
41       * Resolves the given parameter into a method argument.
42       *
43       * @param messageContext the current message context
44       * @param parameter      the parameter to resolve to an argument. This parameter must have previously been passed to
45       *                       the {@link #supportsParameter(MethodParameter)} method of this interface, which must
46       *                       have returned {@code true}.
47       * @return the resolved argument. May be {@code null}.
48       * @throws Exception in case of errors
49       */
50      Object resolveArgument(MessageContext messageContext, MethodParameter parameter) throws Exception;
51  
52  }