Example usage for org.apache.commons.bcel6.classfile JavaClass getAllInterfaces

List of usage examples for org.apache.commons.bcel6.classfile JavaClass getAllInterfaces

Introduction

In this page you can find the example usage for org.apache.commons.bcel6.classfile JavaClass getAllInterfaces.

Prototype

public JavaClass[] getAllInterfaces() throws ClassNotFoundException 

Source Link

Document

Get all interfaces implemented by this JavaClass (transitively).

Usage

From source file:ru.objective.jni.utils.Utils.java

public static boolean isExportClass(JavaClass javaClass, String[] excludes, String[] excludedPackages)
        throws ClassNotFoundException {
    if (javaClass.isAnonymous() || javaClass.isAnnotation() || javaClass.isSynthetic())
        return false;

    if (isClassNameExcluded(javaClass.getClassName(), excludes, excludedPackages))
        return false;

    try {//from  ww w  .j ava  2 s. c  o m
        JavaClass[] interfaces = javaClass.getAllInterfaces();
        JavaClass[] supers = javaClass.getSuperClasses();

        for (JavaClass superClass : supers) {
            if (isClassNameExcluded(superClass.getClassName(), excludes, excludedPackages))
                return false;
        }

        for (JavaClass superInterface : interfaces) {
            if (isClassNameExcluded(superInterface.getClassName(), excludes, excludedPackages))
                return false;
        }
    } catch (ClassNotFoundException cnf) {
        System.out.println();
        System.out.println("WARNING! One of superclass or interface of class " + javaClass.getClassName()
                + " does not included in classpath and will skip. Reason: " + cnf.getLocalizedMessage());

        return false; // ignore classes that does not included in classpath
    }

    return true;
}