Java Reflection Method Name getMethod(String name, Method method)

Here you can find the source of getMethod(String name, Method method)

Description

get Method

License

Open Source License

Declaration

public static String getMethod(String name, Method method) 

Method Source Code

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

import java.lang.reflect.Method;

public class Main {
    public static String getMethod(String name, Method method) {
        if (method.getParameterTypes().length == 1 && method.getParameterTypes()[0] == boolean.class) {
            if (name.length() > 1) {
                return "is" + Character.toUpperCase(name.charAt(0)) + name.substring(1);
            } else {
                return "is" + Character.toUpperCase(name.charAt(0));
            }/*from  ww w  . j a v a  2 s .  com*/
        }
        if (name.length() > 1) {
            return "get" + Character.toUpperCase(name.charAt(0)) + name.substring(1);
        } else {
            return "get" + Character.toUpperCase(name.charAt(0));
        }
    }
}

Related

  1. getMethod(String methodName, Class type)
  2. getMethod(String methodName, Class[] paramTypes, Class targetClass)
  3. getMethod(String methodName, Class[] params)
  4. getMethod(String methodName, Method method, boolean fromComponentType)
  5. getMethod(String name, Class pojoClass)
  6. getMethod(String name, String methodDesc, Class actual)
  7. getMethod(String strMethodPrefix, A instance, String strAttributeName, Class clazz)
  8. getMethodAsAccessible(String methodName, Class clazz)
  9. getMethodByName(Class clazz, String methodName)