Package br.com.experian.pbd.plugin.information

Source Code of br.com.experian.pbd.plugin.information.JavassistClassInformation

package br.com.experian.pbd.plugin.information;

import javassist.ClassPool;
import javassist.CtClass;
import javassist.NotFoundException;

public class JavassistClassInformation implements ClassInformation {


  private ClassPool classPool ;


  public JavassistClassInformation() {
    classPool = new ClassPool();
  }


  public void setClassPath(String path) {
    if(path == null)
      throw new IllegalArgumentException("path isn't null");
      try {
        classPool.appendClassPath(path);
      } catch (NotFoundException e) {
        throw new IllegalArgumentException("path not found");
      }
  }


  public boolean isInterface(String className) throws ClassNotFoundException {
    try {
      CtClass ctClass = classPool.get(className);
      return ctClass.isInterface();
    } catch (NotFoundException e) {
      throw new ClassNotFoundException( className + " not found");
    }
  }

}
TOP

Related Classes of br.com.experian.pbd.plugin.information.JavassistClassInformation

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.