001/* 002 * Copyright 2002-2018 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.batch.support; 018 019import java.lang.reflect.Method; 020 021import org.springframework.lang.Nullable; 022 023/** 024 * Strategy interface for detecting a single Method on a Class. 025 * 026 * @author Mark Fisher 027 * @author Mahmoud Ben Hassine 028 */ 029public interface MethodResolver { 030 031 /** 032 * Find a single Method on the provided Object that matches this resolver's 033 * criteria. 034 * 035 * @param candidate the candidate Object whose Class should be searched for 036 * a Method 037 * 038 * @return a single Method or <code>null</code> if no Method matching this 039 * resolver's criteria can be found. 040 * 041 * @throws IllegalArgumentException if more than one Method defined on the 042 * given candidate's Class matches this resolver's criteria 043 */ 044 @Nullable 045 Method findMethod(Object candidate) throws IllegalArgumentException; 046 047 /** 048 * Find a <em>single</em> Method on the given Class that matches this 049 * resolver's criteria. 050 * 051 * @param clazz the Class instance on which to search for a Method 052 * 053 * @return a single Method or <code>null</code> if no Method matching this 054 * resolver's criteria can be found. 055 * 056 * @throws IllegalArgumentException if more than one Method defined on the 057 * given Class matches this resolver's criteria 058 */ 059 @Nullable 060 Method findMethod(Class<?> clazz); 061 062}