All Packages Class Hierarchy This Package Previous Next Index
Class BIT.highBIT.ClassInfo
java.lang.Object
|
+----BIT.highBIT.ClassInfo
- public class ClassInfo
- extends Object
Contains information about a Java .class file.
- See Also:
- ClassFile, Routine
-
class_name
- Name of this class.
-
classfile
-
Contains parsed class structure.
-
routines
- Vector of methods defined in this class file.
-
source_file_name
- Name of the source file.
-
superclass_name
- Name of super class.
-
ClassInfo(String)
- Creates a new ClassInfo class which breaks down a .class
into more easily manageble entities such as Routines.
-
addAfter(String, String, Object)
- Allows one to add a method after this class.
-
addBefore(String, String, Object)
- Allows one to add a method before this class.
-
addConstantPoolEntry(Cp_Info)
- Adds an entry to the constant pool.
-
getClassName()
- Returns the name of this class.
-
getConstantPool()
-
-
getRoutineCount()
- Returns the number of routiens in this class.
-
getRoutines()
-
Returns the routines in this class.
-
getSourceFileName()
- Returns the name of the source file.
-
getSuperClassName()
- Returns the name of the super class.
-
isExit(int)
-
-
write(String)
- Outputs the class file structure to a file.
classfile
protected ClassFile classfile
- Contains parsed class structure.
- See Also:
- ClassFile
class_name
protected String class_name
- Name of this class.
This value can be read by invoking getClassName method.
- See Also:
- getClassName
superclass_name
protected String superclass_name
- Name of super class.
This value can be read by invoking getSuperClassName method.
- See Also:
- getSuperClassName
source_file_name
protected String source_file_name
- Name of the source file.
This value can be read by invoking getSourceFileName method.
- See Also:
- getSourceFileName
routines
protected Vector routines
- Vector of methods defined in this class file.
This value is set when the constructor is invoked and can be
read by invoking getRoutines method.
- See Also:
- getRoutines, Vector
ClassInfo
public ClassInfo(String filename)
- Creates a new ClassInfo class which breaks down a .class
into more easily manageble entities such as Routines.
The only attribute that it looks at is the "SourceFile" attribute.
- Parameters:
- filename - the filename of the .class file
to be analyzed
- See Also:
- ClassFile, CONSTANT_Utf8_Info, CONSTANT_Class_Info, Routine, Vector
getClassName
public String getClassName()
- Returns the name of this class.
getSuperClassName
public String getSuperClassName()
- Returns the name of the super class.
getSourceFileName
public String getSourceFileName()
- Returns the name of the source file.
getRoutines
public Vector getRoutines()
- Returns the routines in this class.
- See Also:
- Vector
getRoutineCount
public int getRoutineCount()
- Returns the number of routiens in this class.
getConstantPool
public Cp_Info[] getConstantPool()
addConstantPoolEntry
public Cp_Info[] addConstantPoolEntry(Cp_Info entry)
- Adds an entry to the constant pool.
- Parameters:
- the - constant pool entry to be addded
- Returns:
- the new array where the new entry has been added
- See Also:
- Cp_Info
write
public void write(String filename)
- Outputs the class file structure to a file.
- Parameters:
- the - name of the output file
addBefore
public void addBefore(String classname,
String methodname,
Object arg)
- Allows one to add a method before this class.
- Parameters:
- String - representing the name of the class of the method to be added
- String - the name of the method itself
- Object - to be passed to the method as argument
addAfter
public void addAfter(String classname,
String methodname,
Object arg)
- Allows one to add a method after this class.
Important!
Because a Java program typically consists of different class files,
the meaning of adding a call to a method after a class is not clear.
Here we define adding a method after a class to mean that a call
to a method will be inserted before end of this class only if this class
contains the main method.
In particular, one should note that if a program exits through a call
to System.exit(), Runtime.exit(), or through other abnormal ways,
it cannot be guaranteed that the call inserted will get executed at all
before program termination.
One workaround is to instrument System.exit() and Runtime.exe() in your
own standard Java class library.
Please email us if you know a good way to fix this semantic problem.
- Parameters:
- String - representing the name of the class of the method to be added
- String - the name of the method itself
- Object - to be passed to the method as argument
isExit
public boolean isExit(int index)
All Packages Class Hierarchy This Package Previous Next Index