Java Reflection Method Name getMethodSubjectName(Method method)

Here you can find the source of getMethodSubjectName(Method method)

Description

get Method Subject Name

License

Open Source License

Declaration

private static String getMethodSubjectName(Method method) 

Method Source Code

//package com.java2s;
//copy, modify, merge, publish, distribute, sublicense, and/or sell

import java.lang.reflect.Method;

public class Main {
    private static String getMethodSubjectName(Method method) {
        String subjectName;/*w  w w  .  j a  v  a 2s . c om*/
        String methodName = method.getName();
        if (methodName.startsWith("get"))
            subjectName = methodName.substring(3);
        else if (methodName.startsWith("is"))
            subjectName = methodName.substring(2);
        else
            subjectName = methodName;

        if ((subjectName.length() > 1) && (Character.isLowerCase(subjectName.charAt(1))))
            subjectName = Character.toLowerCase(subjectName.charAt(0)) + subjectName.substring(1);
        return subjectName;
    }
}

Related

  1. getMethods(Class type, String name)
  2. getMethods(final Class cl, final String name, final int params)
  3. getMethods(final Class clazz, final String methodName)
  4. getMethods(String classname)
  5. getMethodsByName(Class cls, String methodName)
  6. getMethodsWithName(Class clazz, String name)
  7. getMethodType(Class clazz, String methodName)
  8. getMethodUniqueName(Method method)