Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    /**
     * @param clz class name
     * @param funcName function name
     * @return true if the function is in the class, else false
     */
    public static boolean existsFunc(Class clz, String funcName, Class parameterTypes) {
        if (null != clz) {
            try {
                return clz.getDeclaredMethod(funcName, parameterTypes) != null;
            } catch (Exception e) {
            }
            if (clz != Object.class) {
                return existsFunc(clz.getSuperclass(), funcName, parameterTypes);
            }
        }
        return false;
    }
}