Java Reflection Method Get from Object getMethod(Object oo, String mname)

Here you can find the source of getMethod(Object oo, String mname)

Description

get Method

License

Open Source License

Declaration

public static Method getMethod(Object oo, String mname) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.lang.reflect.Method;

public class Main {
    public static final String METHOD_PRIFIX = "set";

    public static Method getMethod(Object oo, String mname) {
        try {//from   www .j  a  v a  2  s.c om
            Method method = oo.getClass().getMethod(toMethodName(mname),
                    new Class[] { String.class });
            return method;
        } catch (Exception ex) {
            return null;
        }
    }

    public static String toMethodName(String mname) {
        return METHOD_PRIFIX + mname.substring(0, 1).toUpperCase()
                + mname.substring(1);
    }
}

Related

  1. getMethod(Object obj, String methodName, Class paramClass)
  2. getMethod(Object obj, String methodName, Class... parameterTypes)
  3. getMethod(Object obj, String name, Class... types)
  4. getMethod(Object object, String methodName, Class... arguments)
  5. getMethod(Object object, String name, Object... params)
  6. getMethod(Object pojo, String methodName, Class[] params)
  7. getMethod(Object target, String methodName)
  8. getMethod(Object target, String methodName, Class... parameterTypes)
  9. getMethod(Object target, String signature)