public final class ClassInfo
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
ACC_ABSTRACT |
static int |
ACC_ALL_INNER_CFLAGS |
static int |
ACC_FINAL |
static int |
ACC_INTERFACE |
static int |
ACC_PUBLIC |
static int |
ACC_SUPER |
int |
accessFlags |
ClassPathElement |
classPathElement |
jbet.ConstantPool |
constantPool |
boolean |
deprecated |
boolean |
dirty |
java.util.Vector |
fields |
java.util.Vector |
interfaces |
static java.lang.String |
JbetLogFacility |
java.util.Vector |
methods |
java.lang.String |
sourceFile |
java.lang.String |
superClass |
boolean |
synthetic |
java.lang.String |
thisClass |
Constructor and Description |
---|
ClassInfo(ClassInfo cr)
Create a new ClassInfo by copying from another.
|
ClassInfo(ClassPathElement cpElement,
Lexer lexer)
Supports the JBET assembler/disassembler feature.
|
ClassInfo(ClassPathElement cpElement,
java.lang.String thisClass)
Construct a new, empty ClassInfo object.
|
ClassInfo(java.io.InputStream in)
Create either a single ClassInfo, or a tree of ClassInfo objects.
|
ClassInfo(java.io.InputStream in,
ClassPathElement cpElement) |
ClassInfo(java.io.InputStream in,
ClassPathElement cpElement,
java.lang.String filename) |
Modifier and Type | Method and Description |
---|---|
void |
addField(FieldInfo fi) |
void |
addMethod(MethodInfo mi) |
static java.lang.String |
allCommonAncestors(java.lang.String classA,
java.lang.String classB) |
boolean |
checkAccess(java.lang.String fromPackage) |
static java.lang.String |
common_ancestor(java.lang.String classA,
java.lang.String classB)
this should be in Util as well
Used by Type.
|
jbet.ConstantPool |
constantPool() |
void |
disassemble(LineWriter out,
java.lang.String prefix)
JBET assembler support that isn't in a constructor.
|
FieldInfo |
fieldAt(int i) |
FieldInfo |
findField(java.lang.String name) |
MethodInfo |
findMethod(java.lang.String name) |
MethodInfo |
findMethod(java.lang.String name,
Descriptor type) |
MethodInfo |
findMethod(java.lang.String name,
java.lang.String type) |
int |
findMethodIndex(java.lang.String name,
Descriptor type) |
FieldInfo |
getField(java.lang.String name) |
java.lang.String |
getPackageName() |
ClassPathElement |
getPathElement() |
java.lang.String |
getSuperName() |
static boolean |
hasAncestors(java.lang.String child,
java.util.Vector parents) |
jbet.InnerClassInfo |
innerClassAt(int i) |
boolean |
inPackage(java.lang.String packname) |
java.lang.String |
interfaceAt(int i) |
static boolean |
isAncestor(java.lang.String child,
java.lang.String parent)
This should really be in Util.
|
boolean |
isAnon()
Returns true if the class is an anonymous inner class of either
flavor.
|
boolean |
isDirty() |
boolean |
isFinal() |
boolean |
isInterface() |
MethodInfo |
methodAt(int i) |
java.lang.String |
name() |
int |
numFields() |
int |
numInterfaces() |
int |
numMethods() |
void |
printAll(LineWriter out) |
void |
printcp(LineWriter out,
int v) |
void |
printFields(LineWriter out,
boolean header) |
void |
printFields(LineWriter out,
int v) |
void |
printMethodNames(LineWriter out) |
void |
printMethods(LineWriter out,
int v) |
void |
printout(LineWriter out,
int v)
Functions to print portions of this ClassInfo object.
|
void |
relocate(java.util.Hashtable subs)
This method is the top level of a name-changing mechanism that
spans a number of the core JBET abstractions.
|
void |
removeField(FieldInfo fi) |
void |
removeMethod(MethodInfo fi) |
void |
resolveConstants()
The purpose of this method, and the methods it calls, is to
reconstruct a valid, unique ConstantPool.
|
void |
setDirty() |
void |
setOutdir(ClassPathElement cpe) |
java.lang.String |
toString()
Return this class's name.
|
void |
write()
Called by Jbet.
|
void |
writeFile(java.io.DataOutputStream dataOut) |
void |
writeFile(java.io.OutputStream out) |
public static java.lang.String JbetLogFacility
public ClassPathElement classPathElement
public boolean dirty
public jbet.ConstantPool constantPool
public int accessFlags
public java.lang.String thisClass
public java.lang.String superClass
public java.util.Vector interfaces
public java.util.Vector fields
public java.util.Vector methods
public boolean synthetic
public boolean deprecated
public java.lang.String sourceFile
public static final int ACC_PUBLIC
public static final int ACC_FINAL
public static final int ACC_SUPER
public static final int ACC_INTERFACE
public static final int ACC_ABSTRACT
public static final int ACC_ALL_INNER_CFLAGS
public ClassInfo(ClassPathElement cpElement, java.lang.String thisClass)
cpElement
- Input/Output streams for the new object.thisClass
- The name of the new class.public ClassInfo(java.io.InputStream in) throws ClassFileException, java.io.IOException
in
- The data stream from which to read the root ClassInfo.cpElement
- Input/Output streams for the new object.parent
- Should be set to null if this is the root.ClassFileException
java.io.IOException
public ClassInfo(java.io.InputStream in, ClassPathElement cpElement) throws ClassFileException, java.io.IOException
ClassFileException
java.io.IOException
public ClassInfo(java.io.InputStream in, ClassPathElement cpElement, java.lang.String filename) throws ClassFileException, java.io.IOException
ClassFileException
java.io.IOException
public ClassInfo(ClassInfo cr)
cr
- The original ClassInfo.public ClassInfo(ClassPathElement cpElement, Lexer lexer) throws ClassFileException
cpElement
- Input/Output streams for the new object.lexer
- A lexer whose tokens drive the object's
construction.ClassFileException
public void setOutdir(ClassPathElement cpe)
public FieldInfo getField(java.lang.String name) throws ElementNotFoundException
ElementNotFoundException
public void write() throws java.lang.Exception
java.lang.Exception
public void writeFile(java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public void writeFile(java.io.DataOutputStream dataOut) throws java.io.IOException
java.io.IOException
public void relocate(java.util.Hashtable subs)
subs
- A table of string substitution pairs. The key
values should be the old names, and the values
associated with the keys in the table should be the
replacement values. For example, call
subs.put(name, newname) prior to calling relocate.public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String name()
public ClassPathElement getPathElement()
public boolean isAnon()
public void disassemble(LineWriter out, java.lang.String prefix)
out
- prefix
- public void resolveConstants()
public java.lang.String getSuperName()
public jbet.ConstantPool constantPool()
public int numMethods()
public int numFields()
public int numInterfaces()
public java.lang.String interfaceAt(int i)
public FieldInfo fieldAt(int i)
public MethodInfo methodAt(int i)
public void addMethod(MethodInfo mi)
public void addField(FieldInfo fi)
public void removeField(FieldInfo fi)
public void removeMethod(MethodInfo fi)
public jbet.InnerClassInfo innerClassAt(int i)
public MethodInfo findMethod(java.lang.String name, java.lang.String type)
public MethodInfo findMethod(java.lang.String name)
public MethodInfo findMethod(java.lang.String name, Descriptor type)
public FieldInfo findField(java.lang.String name)
public int findMethodIndex(java.lang.String name, Descriptor type)
public void printout(LineWriter out, int v)
public void printFields(LineWriter out, int v)
public void printFields(LineWriter out, boolean header)
public void printMethodNames(LineWriter out)
public void printMethods(LineWriter out, int v)
public void printcp(LineWriter out, int v)
public void printAll(LineWriter out)
public boolean isInterface()
public boolean isFinal()
public static boolean isAncestor(java.lang.String child, java.lang.String parent) throws ClassFileException
child
- parent
- ClassFileException
public static java.lang.String common_ancestor(java.lang.String classA, java.lang.String classB) throws ClassFileException
ClassFileException
public static boolean hasAncestors(java.lang.String child, java.util.Vector parents) throws ClassFileException
ClassFileException
public static java.lang.String allCommonAncestors(java.lang.String classA, java.lang.String classB) throws ClassFileException
ClassFileException
public boolean isDirty()
public void setDirty()
public boolean inPackage(java.lang.String packname)
public java.lang.String getPackageName()
public boolean checkAccess(java.lang.String fromPackage)