Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

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

import java.util.List;

public class Main {

    public static Method[] getSelfMethod(Object o) {
        Class c = o.getClass();
        Method[] ms = o.getClass().getMethods();
        List list = new ArrayList();
        for (Method m : ms) {
            int mod = m.getModifiers();
            if (m.getDeclaringClass().equals(c) && Modifier.isPublic(mod) && !Modifier.isStatic(mod)) {
                list.add(m);
            }

        }
        return (Method[]) list.toArray(new Method[0]);
    }
}