Java Reflection Method Get from Object getMethods(Object obj, boolean hasParent)

Here you can find the source of getMethods(Object obj, boolean hasParent)

Description

get Methods

License

Apache License

Declaration

public static Method[] getMethods(Object obj, boolean hasParent) throws Exception 

Method Source Code

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

import java.lang.reflect.Method;

public class Main {

    public static Method[] getMethods(Object obj, boolean hasParent) throws Exception {
        if (isEmpty(obj)) {
            return null;
        }//from  w w w.  j  ava 2 s . co m

        if (hasParent)
            return obj.getClass().getMethods();
        return obj.getClass().getDeclaredMethods();
    }

    public static boolean isEmpty(Object obj) throws Exception {
        return obj == null;
    }
}

Related

  1. getMethodResult(final Object element, final String methodName)
  2. getMethodReturn(String className, String methodName, Class[] params, Object[] args, boolean isStatic)
  3. getMethodReturnTypeGeneric(Object source, Method method)
  4. getMethods(Class objectClass, Class annotationClass)
  5. getMethods(Object instance, String name, Class[] arguments, boolean isPrefix)
  6. getMethods(Object obj, int cmpModifier, String prefix)
  7. getMethodsAnnotatedWith(Class ann, Object o)
  8. getMethodsAnnotatedWith(Object target, Class annotation)
  9. getMethodsAnnotatedWithValue(Class anno, Object o, String name, Object value)