public class ClassInfo
extends org.objectweb.asm.commons.EmptyVisitor
Holds information about a loaded class in a way that doesn't rely on the underlying API used to load the class information.
This class relies on the ASM byte-code manipulation library. If that library is not available, this package will not work. See asm.objectweb.org for details on ASM.
Constructor and Description |
---|
ClassInfo(java.io.File classFile)
Create a ClassInfo object from a file.
|
ClassInfo(java.io.InputStream is)
Create a ClassInfo object from an InputStream.
|
Modifier and Type | Method and Description |
---|---|
java.io.File |
getClassLocation()
Get the location (the jar file, zip file or directory) where the
class was found.
|
java.lang.String |
getClassName()
Get the class name.
|
java.util.Set<FieldInfo> |
getFields()
Get the set of fields in the class.
|
java.lang.String[] |
getInterfaces()
Get the names of all directly implemented interfaces.
|
java.util.Set<MethodInfo> |
getMethods()
Get the set of methods in the class.
|
int |
getModifier()
Get the Reflection API-based modifier bitfield for the class.
|
java.lang.String |
getSuperClassName()
Get the parent (super) class name, if any.
|
java.lang.String |
toString()
Get a string representation of this object.
|
void |
visit(int version,
int access,
java.lang.String name,
java.lang.String signature,
java.lang.String superName,
java.lang.String[] interfaces)
"Visit" a class.
|
org.objectweb.asm.FieldVisitor |
visitField(int access,
java.lang.String name,
java.lang.String description,
java.lang.String signature,
java.lang.Object value)
"Visit" a field.
|
org.objectweb.asm.MethodVisitor |
visitMethod(int access,
java.lang.String name,
java.lang.String description,
java.lang.String signature,
java.lang.String[] exceptions)
"Visit" a method.
|
visit, visitAnnotation, visitAnnotation, visitAnnotationDefault, visitArray, visitAttribute, visitCode, visitEnd, visitEnum, visitFieldInsn, visitFrame, visitIincInsn, visitInnerClass, visitInsn, visitIntInsn, visitJumpInsn, visitLabel, visitLdcInsn, visitLineNumber, visitLocalVariable, visitLookupSwitchInsn, visitMaxs, visitMethodInsn, visitMultiANewArrayInsn, visitOuterClass, visitParameterAnnotation, visitSource, visitTableSwitchInsn, visitTryCatchBlock, visitTypeInsn, visitVarInsn
public ClassInfo(java.io.File classFile) throws ClassUtilException
classFile
- the abstract path to the class file to loadClassUtilException
- load errorpublic ClassInfo(java.io.InputStream is) throws ClassUtilException
is
- the open InputStream containing the class bytesClassUtilException
- load errorpublic java.lang.String getClassName()
public java.lang.String getSuperClassName()
ClassFinder.findAllSuperClasses(org.clapper.util.classutil.ClassInfo, java.util.Map<java.lang.String, org.clapper.util.classutil.ClassInfo>)
.ClassFinder.findAllSuperClasses(org.clapper.util.classutil.ClassInfo, java.util.Map<java.lang.String, org.clapper.util.classutil.ClassInfo>)
public java.lang.String[] getInterfaces()
ClassFinder.findAllInterfaces(org.clapper.util.classutil.ClassInfo, java.util.Map<java.lang.String, org.clapper.util.classutil.ClassInfo>)
.ClassFinder.findAllInterfaces(org.clapper.util.classutil.ClassInfo, java.util.Map<java.lang.String, org.clapper.util.classutil.ClassInfo>)
public int getModifier()
public java.io.File getClassLocation()
public java.util.Set<FieldInfo> getFields()
public java.util.Set<MethodInfo> getMethods()
public java.lang.String toString()
toString
in class java.lang.Object
public void visit(int version, int access, java.lang.String name, java.lang.String signature, java.lang.String superName, java.lang.String[] interfaces)
visit
in interface org.objectweb.asm.ClassVisitor
visit
in class org.objectweb.asm.commons.EmptyVisitor
version
- class versionaccess
- class access modifiers, etc.name
- internal class namesignature
- class signature (not used here)superName
- internal super class nameinterfaces
- internal names of all directly implemented
interfacespublic org.objectweb.asm.FieldVisitor visitField(int access, java.lang.String name, java.lang.String description, java.lang.String signature, java.lang.Object value)
visitField
in interface org.objectweb.asm.ClassVisitor
visitField
in class org.objectweb.asm.commons.EmptyVisitor
access
- field access modifiers, etc.name
- field namedescription
- field descriptionsignature
- field signaturevalue
- field value, if anypublic org.objectweb.asm.MethodVisitor visitMethod(int access, java.lang.String name, java.lang.String description, java.lang.String signature, java.lang.String[] exceptions)
visitMethod
in interface org.objectweb.asm.ClassVisitor
visitMethod
in class org.objectweb.asm.commons.EmptyVisitor
access
- field access modifiers, etc.name
- field namedescription
- field descriptionsignature
- field signatureexceptions
- list of exception names the method throws