Java Code Examples for javassist.bytecode.ClassFile#getSuperclass()

The following examples show how to use javassist.bytecode.ClassFile#getSuperclass() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClassPathScanner.java    From Bats with Apache License 2.0 5 votes vote down vote up
@Override
public void scan(final Object cls) {
  final ClassFile classFile = (ClassFile)cls;
  String className = classFile.getName();
  String superclass = classFile.getSuperclass();
  boolean isAbstract = (classFile.getAccessFlags() & (AccessFlag.INTERFACE | AccessFlag.ABSTRACT)) != 0;
  ChildClassDescriptor scannedClass = new ChildClassDescriptor(className, isAbstract);
  if (!superclass.equals(Object.class.getName())) {
    children.put(superclass, scannedClass);
  }
  for (String anInterface : classFile.getInterfaces()) {
    children.put(anInterface, scannedClass);
  }
}
 
Example 2
Source File: ClassPathScanner.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public void scan(final Object cls) {
  final ClassFile classFile = (ClassFile)cls;
  String className = classFile.getName();
  String superclass = classFile.getSuperclass();
  boolean isAbstract = (classFile.getAccessFlags() & (AccessFlag.INTERFACE | AccessFlag.ABSTRACT)) != 0;
  ChildClassDescriptor scannedClass = new ChildClassDescriptor(className, isAbstract);
  if (!superclass.equals(Object.class.getName())) {
    children.put(superclass, scannedClass);
  }
  for (String anInterface : classFile.getInterfaces()) {
    children.put(anInterface, scannedClass);
  }
}
 
Example 3
Source File: JPackage.java    From jadira with Apache License 2.0 5 votes vote down vote up
public Set<JClass> getClasses() throws ClasspathAccessException {

        Set<JClass> retVal = new HashSet<JClass>();
        List<? extends ClassFile> classes = getResolver().getClassFileResolver().resolveAll(null, CLASSPATH_PROJECTOR, new PackageFileFilter(getName(), false), new PackagePrefixFilter(this), new JElementTypeFilter(JClass.class)); 
        for (ClassFile classFile : classes) {

        	if ((classFile.getSuperclass() != null) && 
        			(!classFile.isInterface() && (!classFile.getSuperclass().equals("java.lang.Enum"))
	            		&& (classFile.getInnerAccessFlags() == -1))) {
        		retVal.add(JClass.getJClass(classFile, getResolver()));
        	}
        }
        return retVal;
    }
 
Example 4
Source File: JavassistAdapter.java    From panda with Apache License 2.0 4 votes vote down vote up
@Override
public String getSuperclassName(ClassFile cls) {
    return cls.getSuperclass();
}