get Single Argument Method - Java Reflection

Java examples for Reflection:Method Parameter

Description

get Single Argument Method

Demo Code


//package com.java2s;

import java.lang.reflect.Method;

public class Main {

    public static Method getSingleArgMethod(final Class<?> clazz,
            final Class<?> argClass, final String methodName) {
        try {//  www  .ja  v  a  2  s  .  c  o  m
            return clazz.getMethod(methodName, argClass);
        } catch (final NoSuchMethodException e) {
            e.printStackTrace();
        } catch (final SecurityException e) {
            e.printStackTrace();
        }
        return null;
    }
}

Related Tutorials