All Packages Class Hierarchy This Package Previous Next Index
Class DE.fub.inf.JVM.JavaClass.JavaClass
java.lang.Object
|
+----DE.fub.inf.JVM.JavaClass.JavaClass
- public class JavaClass
- extends Object
- implements Constants
Represents a Java class, i.e. the data structures, constant pool,
fields, methods and commands contained in a Java .class file.
See JVM
specification for details.
- Version:
- 970922
- Author:
- M. Dahm
-
JavaClass(short, short, String, short, short, short, ConstantPool, short[], Field[], Method[], Attribute[])
- Constructor gets all contents as arguments.
-
accept(Visitor)
- Called by objects that are traversing the nodes of the tree implicitely
defined by the contents of a Java class.
-
dump(File)
-
Dump class to a file, this should create a valid .class file.
-
dump(String)
-
Dump class to a file, this should create a valid .class file.
-
getAccessFlags()
-
-
getAttributes()
-
-
getClassName()
-
-
getClassNameIndex()
-
-
getConstantPool()
-
-
getFields()
-
-
getFileName()
-
-
getInterfaceNames()
-
-
getInterfaces()
-
-
getMajor()
-
-
getMethods()
-
-
getMinor()
-
-
getSourceFileName()
-
-
getSuperclassName()
-
-
getSuperclassNameIndex()
-
-
initJavaClass()
- Initialize the package.
-
setAccessFlags(short)
-
-
setAttributes(Attribute[])
-
-
setClassName(String)
-
-
setClassNameIndex(short)
-
-
setConstantPool(ConstantPool)
-
-
setFields(Field[])
-
-
setFileName(String)
-
-
setInterfaceNames(String[])
-
-
setInterfaces(short[])
-
-
setMajor(short)
-
-
setMethods(Method[])
-
-
setMinor(short)
-
-
setSourceFileName(String)
-
-
setSuperclassName(String)
-
-
setSuperclassNameIndex(short)
-
-
toString()
-
JavaClass
public JavaClass(short class_name_index,
short superclass_name_index,
String file_name,
short major,
short minor,
short access_flags,
ConstantPool constant_pool,
short interfaces[],
Field fields[],
Method methods[],
Attribute attributes[])
- Constructor gets all contents as arguments.
- Parameters:
- class_name - Class name
- superclass_name - Superclass name
- file_name - File name
- major - Major compiler version
- minor - Minor compiler version
- access_flags - Access rights defined by bit flags
- constant_pool - Array of constants
- interfaces - Implemented interfaces
- fields - Class fields
- methods - Class methods
- attributes - Class attributes
accept
public void accept(Visitor v)
- Called by objects that are traversing the nodes of the tree implicitely
defined by the contents of a Java class. I.e., the hierarchy of methods,
fields, attributes, etc. spawns a tree of objects.
- Parameters:
- v - Visitor object
dump
public void dump(File file) throws IOException
- Dump class to a file, this should create a valid .class file.
- Parameters:
- file - Output file
dump
public void dump(String file_name) throws IOException
- Dump class to a file, this should create a valid .class file.
- Parameters:
- file_name - Output file name
getAccessFlags
public final short getAccessFlags()
- Returns:
- Access rights of class.
getAttributes
public final Attribute[] getAttributes()
- Returns:
- Attributes of the class.
getClassName
public final String getClassName()
- Returns:
- Class name.
getClassNameIndex
public final short getClassNameIndex()
- Returns:
- Class name index.
getConstantPool
public final ConstantPool getConstantPool()
- Returns:
- Constant pool.
getFields
public final Field[] getFields()
- Returns:
- Fields, i.e. variables of the class.
getFileName
public final String getFileName()
- Returns:
- File name.
getInterfaceNames
public final String[] getInterfaceNames()
- Returns:
- Names of implemented interfaces.
getInterfaces
public final short[] getInterfaces()
- Returns:
- Implemented interfaces.
getMajor
public final short getMajor()
- Returns:
- Major number of compiler version.
getMethods
public final Method[] getMethods()
- Returns:
- Methods of the class.
getMinor
public final short getMinor()
- Returns:
- Minor number of compiler version.
getSourceFileName
public final String getSourceFileName()
- Returns:
- File name of source.
getSuperclassName
public final String getSuperclassName()
- Returns:
- Superclass name.
getSuperclassNameIndex
public final short getSuperclassNameIndex()
- Returns:
- Class name index.
initJavaClass
public static void initJavaClass()
- Initialize the package.
setAccessFlags
public final void setAccessFlags(short access_flags)
setAttributes
public final void setAttributes(Attribute attributes[])
setClassName
public final void setClassName(String class_name)
setClassNameIndex
public final void setClassNameIndex(short class_name_index)
setConstantPool
public final void setConstantPool(ConstantPool constant_pool)
setFields
public final void setFields(Field fields[])
setFileName
public final void setFileName(String file_name)
setInterfaceNames
public final void setInterfaceNames(String interface_names[])
setInterfaces
public final void setInterfaces(short interfaces[])
setMajor
public final void setMajor(short major)
setMethods
public final void setMethods(Method methods[])
setMinor
public final void setMinor(short minor)
setSourceFileName
public final void setSourceFileName(String source_file_name)
setSuperclassName
public final void setSuperclassName(String superclass_name)
setSuperclassNameIndex
public final void setSuperclassNameIndex(short superclass_name_index)
toString
public String toString()
- Returns:
- String representing class contents.
- Overrides:
- toString in class Object
All Packages Class Hierarchy This Package Previous Next Index