Java Reflection Method Getter Get getGetter(final Class clz, final String propertyName)

Here you can find the source of getGetter(final Class clz, final String propertyName)

Description

get Getter

License

Open Source License

Declaration

public static Method getGetter(final Class<?> clz, final String propertyName) throws NoSuchMethodException 

Method Source Code


//package com.java2s;

import java.lang.reflect.Method;

public class Main {
    public static Method getGetter(final Class<?> clz, final String propertyName) throws NoSuchMethodException {
        final Class<?> getterArgs[] = new Class<?>[0];
        final String getterName = "get" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1);
        return clz.getMethod(getterName, getterArgs);
    }//from w  w  w  .  j ava  2s .co  m
}

Related

  1. getGetter(Class clazz, Field field)
  2. getGetter(Class cls, String name, Class type)
  3. getGetter(Class realClass, String pAttributeName)
  4. getGetter(final Class clazz, final String propertyName)
  5. getGetter(final Class clazz, final String fieldName)
  6. getGetter(final Object o, final String fieldName)
  7. getGetter(Object bean, String property)
  8. getGetter(Object instance, String methodName)
  9. getGetter(Object o, String name)