Java Reflection Method Getter Get getGetterName(Field field)

Here you can find the source of getGetterName(Field field)

Description

get Getter Name

License

Apache License

Declaration

public static String getGetterName(Field field) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.lang.reflect.Field;

import java.util.Locale;

public class Main {
    public static String getGetterName(Field field) {
        String name = field.getName();
        if (field.getType().equals(boolean.class)) {
            return "is" + name.substring(0, 1).toUpperCase(Locale.US) + name.substring(1);
        } else {/*from   w ww .j  a v a2 s.  c  o m*/
            return "get" + name.substring(0, 1).toUpperCase(Locale.US) + name.substring(1);
        }
    }
}

Related

  1. getGetterMethods(Class clazz)
  2. getGetterMethods(Class clazz)
  3. getGetterMethods(Class objectType)
  4. getGetterMethods(Class pojoClass)
  5. getGetterMethods(final Class clazz)
  6. getGetterName(Field field)
  7. getGetterName(final Field field)
  8. getGetterName(Method m)
  9. getGetterName(Method m)