Example usage for java.lang Class getDeclaredMethods

List of usage examples for java.lang Class getDeclaredMethods

Introduction

In this page you can find the example usage for java.lang Class getDeclaredMethods.

Prototype

@CallerSensitive
public Method[] getDeclaredMethods() throws SecurityException 

Source Link

Document

Returns an array containing Method objects reflecting all the declared methods of the class or interface represented by this Class object, including public, protected, default (package) access, and private methods, but excluding inherited methods.

Usage

From source file:Main.java

public static void printMethods(Class cl) {
    Method[] methods = cl.getDeclaredMethods();

    for (int i = 0; i < methods.length; i++) {
        Method m = methods[i];/*  w  w w  .  j  a va  2 s  .  c  om*/
        System.out.println(m.toGenericString());

    }
}

From source file:Main.java

public static void printMethods(Class cl) {
    Method[] methods = cl.getDeclaredMethods();

    for (int i = 0; i < methods.length; i++) {
        Method m = methods[i];/*from  www. j av  a 2  s .c om*/
        System.out.println(m.toString());

    }
}

From source file:Main.java

public static void printMethods(Class cl) {
    Method[] methods = cl.getDeclaredMethods();

    for (int i = 0; i < methods.length; i++) {
        Method m = methods[i];// ww  w  .j a v  a  2 s . com
        System.out.println(m.isBridge());

    }
}

From source file:Main.java

public static void printMethods(Class cl) {
    Method[] methods = cl.getDeclaredMethods();

    for (int i = 0; i < methods.length; i++) {
        Method m = methods[i];//  ww w  . ja  v  a  2 s. c  om
        System.out.println(m.isVarArgs());

    }
}

From source file:Main.java

public static void printMethods(Class cl) {
    Method[] methods = cl.getDeclaredMethods();

    for (int i = 0; i < methods.length; i++) {
        Method m = methods[i];/*from   ww w .j  a v  a  2  s .  c o m*/
        System.out.println(m.isSynthetic());

    }
}

From source file:Main.java

public static void printMethods(Class cl) {
    Method[] methods = cl.getDeclaredMethods();

    for (int i = 0; i < methods.length; i++) {
        Method m = methods[i];// w  w  w. jav a2 s.c  o m
        System.out.println(m.hashCode());

    }
}

From source file:Main.java

public static void printMethods(Class cl) {
    Method[] methods = cl.getDeclaredMethods();

    for (int i = 0; i < methods.length; i++) {
        Method m = methods[i];//from www . jav  a 2  s .  c  o  m
        Class retType = m.getReturnType();
        System.out.println(retType.getName());

    }
}

From source file:MainClass.java

public static void printMethods(Class cl) {
    Method[] methods = cl.getDeclaredMethods();

    for (int i = 0; i < methods.length; i++) {
        Method m = methods[i];//from   w w w  .j  a v  a2s.  c  o  m
        Class retType = m.getReturnType();
        Class[] paramTypes = m.getParameterTypes();
        String name = m.getName();
        System.out.print(Modifier.toString(m.getModifiers()));
        System.out.print(" " + retType.getName() + " " + name + "(");
        for (int j = 0; j < paramTypes.length; j++) {
            if (j > 0)
                System.out.print(", ");
            System.out.print(paramTypes[j].getName());
        }
        System.out.println(");");
    }
}

From source file:Main.java

private static Method getBooleanMethod(Class clazz) {
    Method[] methods = clazz.getDeclaredMethods();
    for (Method method : methods) {
        if (TextUtils.equals(method.getName(), "getBoolean")) {
            return method;
        }/*from w w w . ja v  a 2s  .  c o m*/
    }
    return null;
}

From source file:Main.java

private static Method getHasMethod(Class clazz) {
    Method[] methods = clazz.getDeclaredMethods();
    for (Method method : methods) {
        if (TextUtils.equals(method.getName(), "has")) {
            return method;
        }// ww w.  ja va2s .  c  om
    }
    return null;
}