public class ClassFile
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ClassFile.Type |
Constructor and Description |
---|
ClassFile(java.io.InputStream stream)
Load a class file and create a model of the class.
|
ClassFile(java.lang.String className,
ClassFile classFile)
Create a replaced instance.
|
Modifier and Type | Method and Description |
---|---|
int |
getAccessFlags()
The access flags of the class.
|
java.util.Map<java.lang.String,java.lang.Object> |
getAnnotation(java.lang.String annotation)
Get a single annotation or null
|
BootstrapMethod |
getBootstrapMethod(int methodIdx)
Get the x-the BootstrapMethod.
|
ConstantPool |
getConstantPool()
Get the constant pool of the the current class.
|
FieldInfo |
getField(java.lang.String name) |
FieldInfo[] |
getFields()
Get the fields of the class.
|
ConstantClass[] |
getInterfaces() |
MethodInfo |
getMethod(java.lang.String name,
java.lang.String signature)
Find a method via name and signature.
|
MethodInfo[] |
getMethods() |
java.lang.String |
getSourceFile()
Get value of SourceFile if available.
|
ConstantClass |
getSuperClass() |
java.lang.String |
getSuperSignature()
Get the signature of the super class with generic types.
|
ConstantClass |
getThisClass() |
java.lang.String |
getThisSignature()
Get the signature of the class with generic types.
|
ClassFile.Type |
getType()
Get the type of class.
|
void |
partial(ClassFile partialClassFile)
Extends this class with the methods and fields of the partial class.
|
public ClassFile(java.io.InputStream stream) throws java.io.IOException
stream
- The InputStream of the class file. Will be closed if finish.java.io.IOException
- if this input stream reaches the end before reading the class file.public ClassFile(java.lang.String className, ClassFile classFile)
className
- the class name that should be replacedclassFile
- the replacing class file datapublic java.lang.String getSourceFile() throws java.io.IOException
java.io.IOException
- if an I/O error occurs.@Nullable public java.util.Map<java.lang.String,java.lang.Object> getAnnotation(java.lang.String annotation) throws java.io.IOException
annotation
- the class name of the annotationjava.io.IOException
- if any I/O error occurpublic BootstrapMethod getBootstrapMethod(int methodIdx) throws java.io.IOException
methodIdx
- the index of the methodjava.io.IOException
- if any error occurpublic ConstantPool getConstantPool()
public ConstantClass getThisClass()
public ConstantClass getSuperClass()
public ConstantClass[] getInterfaces()
public MethodInfo[] getMethods()
public MethodInfo getMethod(java.lang.String name, java.lang.String signature)
name
- the namesignature
- the signaturepublic FieldInfo getField(java.lang.String name)
public FieldInfo[] getFields()
public int getAccessFlags()
Class.isInterface()
public java.lang.String getThisSignature()
public java.lang.String getSuperSignature()
public ClassFile.Type getType()
public void partial(ClassFile partialClassFile)
partialClassFile
- extension of the class