|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object polyglot.types.reflect.ClassFile
public class ClassFile
ClassFile basically represents a Java classfile as it is found on disk. The classfile is modeled according to the Java Virtual Machine Specification. Methods are provided to edit the classfile at a very low level.
Attribute
,
Constant
,
Field
,
Method
Field Summary | |
---|---|
protected Attribute[] |
attrs
|
protected Constant[] |
constants
|
protected Field[] |
fields
|
protected InnerClasses |
innerClasses
|
protected Method[] |
methods
|
Constructor Summary | |
---|---|
ClassFile(java.io.File classFileSource,
byte[] code,
ExtensionInfo ext)
Constructor. |
Method Summary | |
---|---|
java.lang.String |
compilerVersion(java.lang.String ts)
Get the encoded compiler version used to compile the source. |
Constant[] |
constants()
|
Attribute |
createAttribute(java.io.DataInputStream in,
java.lang.String name,
int nameIndex,
int length)
|
Field |
createField(java.io.DataInputStream in)
|
Method |
createMethod(java.io.DataInputStream in)
|
java.lang.String |
encodedClassType(java.lang.String ts)
Get the encoded class type. |
boolean |
fromClassFile()
Return true if the class is from a class file. |
void |
initConstructors(ParsedClassType ct)
Initialize ct 's constructors. |
void |
initFields(ParsedClassType ct)
Initialize ct 's fields. |
void |
initInterfaces(ParsedClassType ct)
Initialize ct 's interfaces. |
void |
initMemberClasses(ParsedClassType ct)
Initialize ct 's member classes. |
void |
initMethods(ParsedClassType ct)
Initialize ct 's methods. |
java.lang.String |
name()
Get the name of the class, including the package name. |
Position |
position()
Create a position for the class file. |
long |
rawSourceLastModified()
|
void |
readAttributes(java.io.DataInputStream in)
Read the class's attributes. |
long |
sourceLastModified(java.lang.String ts)
Get the encoded source modified time. |
ParsedClassType |
type(TypeSystem ts)
Extract the class type from the class file. |
ClassType |
typeForName(TypeSystem ts,
java.lang.String name)
Convert a String into a type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Constant[] constants
protected Field[] fields
protected Method[] methods
protected Attribute[] attrs
protected InnerClasses innerClasses
Constructor Detail |
---|
public ClassFile(java.io.File classFileSource, byte[] code, ExtensionInfo ext)
code
- A byte array containing the class dataMethod Detail |
---|
public Method createMethod(java.io.DataInputStream in) throws java.io.IOException
java.io.IOException
public Field createField(java.io.DataInputStream in) throws java.io.IOException
java.io.IOException
public Attribute createAttribute(java.io.DataInputStream in, java.lang.String name, int nameIndex, int length) throws java.io.IOException
java.io.IOException
public Constant[] constants()
public boolean fromClassFile()
LazyClassInitializer
fromClassFile
in interface LazyClassInitializer
public long sourceLastModified(java.lang.String ts)
public long rawSourceLastModified()
public java.lang.String compilerVersion(java.lang.String ts)
public java.lang.String encodedClassType(java.lang.String ts)
public ParsedClassType type(TypeSystem ts) throws SemanticException
SemanticException
public void initMemberClasses(ParsedClassType ct)
ct
's member classes.
initMemberClasses
in interface LazyClassInitializer
public void initInterfaces(ParsedClassType ct)
ct
's interfaces.
initInterfaces
in interface LazyClassInitializer
public void initFields(ParsedClassType ct)
ct
's fields.
initFields
in interface LazyClassInitializer
public void initMethods(ParsedClassType ct)
ct
's methods.
initMethods
in interface LazyClassInitializer
public void initConstructors(ParsedClassType ct)
ct
's constructors.
initConstructors
in interface LazyClassInitializer
public ClassType typeForName(TypeSystem ts, java.lang.String name) throws SemanticException
SemanticException
public Position position()
public java.lang.String name()
public void readAttributes(java.io.DataInputStream in) throws java.io.IOException
in
- The stream from which to read.
java.io.IOException
- If an error occurs while reading.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |