Java Reflection Method Getter Get getGetters(Class c)

Here you can find the source of getGetters(Class c)

Description

get Getters

License

Apache License

Declaration

public static List<Method> getGetters(Class c) 

Method Source Code


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

import java.lang.reflect.Method;
import java.util.ArrayList;

import java.util.List;

public class Main {
    public static List<Method> getGetters(Class c) {
        List<Method> list = new ArrayList<Method>();
        Method[] methods = c.getMethods();
        for (int i = 0; i < methods.length; i++) {
            String name = methods[i].getName();
            if (!name.startsWith("get") || name.equals("getClass") || name.equals("getInstance")
                    || methods[i].getParameterTypes().length != 0) {
                continue;
            }/*from   w  w w.java2s  .c  o m*/
            list.add(methods[i]);
        }
        return list;
    }
}

Related

  1. getGetterName(Method m)
  2. getGetterName(Method method)
  3. getGetterName(Method mtd)
  4. getGetterOrNull(Class clazz, String name, Class type)
  5. getGetterPropertyName(Method getterMethod)
  6. getGetters(Class clazz)
  7. getGetters(Class klass)
  8. getGetters(Class c)
  9. getGetters(Class clazz)