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 handle method return values. 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 MethodReturnValueHandler {
31  
32      /**
33       * Indicates whether the given {@linkplain MethodParameter method return type} is supported by this handler.
34       *
35       * @param returnType the method return type to check
36       * @return {@code true} if this handler supports the supplied return type; {@code false} otherwise
37       */
38      boolean supportsReturnType(MethodParameter returnType);
39  
40      /**
41       * Handles the given return value.
42       *
43       * @param messageContext the current message context
44       * @param returnType     the return type to handle. This type must have previously been passed to the {@link
45       *                       #supportsReturnType(MethodParameter)} method of this interface, which must have returned
46       *                       {@code true}.
47       * @param returnValue    the return value to handle
48       * @throws Exception in case of errors
49       */
50      void handleReturnValue(MessageContext messageContext, MethodParameter returnType, Object returnValue)
51              throws Exception;
52  
53  
54  }