Here you can find the source of getMethod(final Field visitee, final String methodName, final Class>... parameterTypes)
Parameter | Description |
---|---|
visitee | a parameter |
methodName | a parameter |
parameterTypes | a parameter |
public static Method getMethod(final Field visitee, final String methodName, final Class<?>... parameterTypes)
//package com.java2s; /*/*from w w w.j av a2 s . co m*/ * Copyright 2013 axn software UG * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.lang.reflect.Field; import java.lang.reflect.Method; public class Main { /** * Gets the method specified by {@code methodName} for the optionally * specified {@code parameterTypes} from the specified {@code visitee}'s * declaring class. * * @param visitee * @param methodName * @param parameterTypes * @return the method */ public static Method getMethod(final Field visitee, final String methodName, final Class<?>... parameterTypes) { Method result = null; try { result = visitee.getDeclaringClass().getMethod(methodName, parameterTypes); } catch (NoSuchMethodException e) { // FIXME:requires more elaborate information for the user throw new RuntimeException("Unable to access method " + methodName + " for field:" + visitee.toString(), e); } return result; } }