Java Reflection Method Getter Get getGetter(String name, Type type)

Here you can find the source of getGetter(String name, Type type)

Description

get Getter

License

CDDL license

Declaration

public static String getGetter(String name, Type type) 

Method Source Code

//package com.java2s;
//License from project: CDDL license 

import java.lang.reflect.Type;

public class Main {
    public static String getGetter(String name, Type type) {
        if (name.startsWith("_"))
            name = name.substring(1);// w w  w  . j a v a2  s  .c o  m

        String prefix;
        if (type != null && boolean.class.equals(type)) {
            prefix = "is";
        } else {
            prefix = "get";
        }
        return prefix + name.substring(0, 1).toUpperCase() + name.substring(1);
    }

    public static String getGetter(String name) {
        return getGetter(name, null);
    }
}

Related

  1. getGetter(Object bean, String property)
  2. getGetter(Object instance, String methodName)
  3. getGetter(Object o, String name)
  4. getGetter(Object object, String name)
  5. getGetter(String key, Class clazz)
  6. getGetter(String propertyName, Class clazz)
  7. getGetterAttributeType(Method m)
  8. getGetterFieldName(Method method)
  9. getGetterFields(final Class clazz)