View Javadoc
1   /*
2    * Copyright 2002-2012 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.core;
18  
19  import java.lang.reflect.Constructor;
20  import java.lang.reflect.Method;
21  
22  /**
23   * Interface to discover parameter names for methods and constructors.
24   *
25   * <p>Parameter name discovery is not always possible, but various strategies are
26   * available to try, such as looking for debug information that may have been
27   * emitted at compile time, and looking for argname annotation values optionally
28   * accompanying AspectJ annotated methods.
29   *
30   * @author Rod Johnson
31   * @author Adrian Colyer
32   * @since 2.0
33   */
34  public interface ParameterNameDiscoverer {
35  
36  	/**
37  	 * Return parameter names for this method,
38  	 * or {@code null} if they cannot be determined.
39  	 * @param method method to find parameter names for
40  	 * @return an array of parameter names if the names can be resolved,
41  	 * or {@code null} if they cannot
42  	 */
43  	String[] getParameterNames(Method method);
44  
45  	/**
46  	 * Return parameter names for this constructor,
47  	 * or {@code null} if they cannot be determined.
48  	 * @param ctor constructor to find parameter names for
49  	 * @return an array of parameter names if the names can be resolved,
50  	 * or {@code null} if they cannot
51  	 */
52  	String[] getParameterNames(Constructor<?> ctor);
53  
54  }