Java Reflection Method Getter Get getGettersMethods(Object object)

Here you can find the source of getGettersMethods(Object object)

Description

get Getters Methods

License

Open Source License

Declaration

public static List<Method> getGettersMethods(Object object) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    public static List<Method> getGettersMethods(Object object) {
        List<Method> getters = new ArrayList<>();
        Method[] methods = object.getClass().getMethods();

        for (Method method : methods) {
            String methodName = method.getName();
            if ((methodName.startsWith("get") || methodName.startsWith("is")) && !methodName.equals("getClass")) {
                getters.add(method);//from  ww  w.j  a v  a  2  s . c  o  m
            }

        }

        return getters;
    }
}

Related

  1. getGetters(Object bean)
  2. getGetters(Object obj)
  3. getGettersAndSetters(Object obj)
  4. getGetterSetterMethodsParameterType(Field f)
  5. getGetterShorthandName(Method method)
  6. getGetterValue(Method method, Object o)
  7. getGetterWithPrefix(final Class target, final String property, final String prefix)