Java Code Examples for javassist.bytecode.ClassFile#getName()
The following examples show how to use
javassist.bytecode.ClassFile#getName() .
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: ClassFileArchiveEntryHandler.java From lams with GNU General Public License v2.0 | 6 votes |
private ClassDescriptor toClassDescriptor(ClassFile classFile, ArchiveEntry entry) { ClassDescriptor.Categorization categorization = ClassDescriptor.Categorization.OTHER;; final AnnotationsAttribute visibleAnnotations = (AnnotationsAttribute) classFile.getAttribute( AnnotationsAttribute.visibleTag ); if ( visibleAnnotations != null ) { if ( visibleAnnotations.getAnnotation( Entity.class.getName() ) != null || visibleAnnotations.getAnnotation( MappedSuperclass.class.getName() ) != null || visibleAnnotations.getAnnotation( Embeddable.class.getName() ) != null ) { categorization = ClassDescriptor.Categorization.MODEL; } else if ( visibleAnnotations.getAnnotation( Converter.class.getName() ) != null ) { categorization = ClassDescriptor.Categorization.CONVERTER; } } return new ClassDescriptorImpl( classFile.getName(), categorization, entry.getStreamAccess() ); }
Example 2
Source File: CheckForBehaviour.java From anno4j with Apache License 2.0 | 6 votes |
public String getClassName(String name, InputStream stream) throws IOException { // NOTE package-info.class should be excluded if (!name.endsWith(".class") || name.contains("-")) return null; DataInputStream dstream = new DataInputStream(stream); try { ClassFile cf = new ClassFile(dstream); if (!cf.isInterface() && !isAnnotationPresent(cf)) { // behaviour that implements a concept for (String fname : cf.getInterfaces()) { String cn = fname.replace('.', '/') + ".class"; InputStream in = cl.getResource(cn).openStream(); try { if (super.getClassName(cn, in) != null) return cf.getName(); } finally { in.close(); } } } } finally { dstream.close(); stream.close(); } return null; }
Example 3
Source File: ClassPathScanner.java From Bats with Apache License 2.0 | 5 votes |
@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 4
Source File: ClassPathScanner.java From dremio-oss with Apache License 2.0 | 5 votes |
@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 5
Source File: CheckForConcept.java From anno4j with Apache License 2.0 | 5 votes |
public String getClassName(String name, InputStream stream) throws IOException { DataInputStream dstream = new DataInputStream(stream); try { ClassFile cf = new ClassFile(dstream); if (checkAccessFlags(cf.getAccessFlags())) { if (isAnnotationPresent(cf)) return cf.getName(); } } finally { dstream.close(); } return null; }
Example 6
Source File: AnnotationDB.java From audit4j-core with Apache License 2.0 | 5 votes |
protected void scanClass(ClassFile cf) { String className = cf.getName(); AnnotationsAttribute visible = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.visibleTag); AnnotationsAttribute invisible = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.invisibleTag); if (visible != null) populate(visible.getAnnotations(), className); if (invisible != null) populate(invisible.getAnnotations(), className); }
Example 7
Source File: JavassistAdapter.java From panda with Apache License 2.0 | 4 votes |
@Override public String getClassName(ClassFile cls) { return cls.getName(); }
Example 8
Source File: JType.java From jadira with Apache License 2.0 | 4 votes |
protected JType(ClassFile classFile, ClasspathResolver resolver) { super(classFile.getName(), resolver); this.classFile = classFile; }
Example 9
Source File: JInterface.java From jadira with Apache License 2.0 | 4 votes |
protected JInterface(ClassFile classFile, ClasspathResolver resolver) { super(classFile, resolver); if (!classFile.isInterface() || (classFile.getSuperclass().equals("java.lang.annotation.Annotation"))) { throw new IllegalArgumentException("Argument was not interface: " + classFile.getName()); } }