View Javadoc

1   /*
2    * Copyright 2002-2008 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.batch.support;
18  
19  import java.lang.reflect.Method;
20  
21  /**
22   * Strategy interface for detecting a single Method on a Class.
23   * 
24   * @author Mark Fisher
25   */
26  public interface MethodResolver {
27  
28  	/**
29  	 * Find a single Method on the provided Object that matches this resolver's
30  	 * criteria.
31  	 * 
32  	 * @param candidate the candidate Object whose Class should be searched for
33  	 * a Method
34  	 * 
35  	 * @return a single Method or <code>null</code> if no Method matching this
36  	 * resolver's criteria can be found.
37  	 * 
38  	 * @throws IllegalArgumentException if more than one Method defined on the
39  	 * given candidate's Class matches this resolver's criteria
40  	 */
41  	Method findMethod(Object candidate) throws IllegalArgumentException;
42  
43  	/**
44  	 * Find a <em>single</em> Method on the given Class that matches this
45  	 * resolver's criteria.
46  	 * 
47  	 * @param clazz the Class instance on which to search for a Method
48  	 * 
49  	 * @return a single Method or <code>null</code> if no Method matching this
50  	 * resolver's criteria can be found.
51  	 * 
52  	 * @throws IllegalArgumentException if more than one Method defined on the
53  	 * given Class matches this resolver's criteria
54  	 */
55  	Method findMethod(Class<?> clazz);
56  
57  }