001/* 002 * Copyright 2002-2013 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.expression; 018 019import java.lang.reflect.Method; 020import java.util.List; 021 022/** 023 * MethodFilter instances allow SpEL users to fine tune the behaviour of the method 024 * resolution process. Method resolution (which translates from a method name in an 025 * expression to a real method to invoke) will normally retrieve candidate methods for 026 * invocation via a simple call to 'Class.getMethods()' and will choose the first one that 027 * is suitable for the input parameters. By registering a MethodFilter the user can 028 * receive a callback and change the methods that will be considered suitable. 029 * 030 * @author Andy Clement 031 * @since 3.0.1 032 */ 033public interface MethodFilter { 034 035 /** 036 * Called by the method resolver to allow the SpEL user to organize the list of 037 * candidate methods that may be invoked. The filter can remove methods that should 038 * not be considered candidates and it may sort the results. The resolver will then 039 * search through the methods as returned from the filter when looking for a suitable 040 * candidate to invoke. 041 * @param methods the full list of methods the resolver was going to choose from 042 * @return a possible subset of input methods that may be sorted by order of relevance 043 */ 044 List<Method> filter(List<Method> methods); 045 046}