Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

jreversepro.reflect
Class JClassInfo  view JClassInfo download JClassInfo.java

java.lang.Object
  extended byjreversepro.reflect.JClassInfo
All Implemented Interfaces:
jreversepro.common.KeyWords

public class JClassInfo
extends java.lang.Object
implements jreversepro.common.KeyWords

JClassInfo is the abstract representation of the Class File. The names of the methods are self explanatory.


Field Summary
private  java.lang.String absPath
          Absolute path where the class' source file was located.
static int ACC_INTERFACE
          ACC_INTERFACE bit required to be set if it is an interface and not a class.
static int ACC_SUPER
          ACC_SUPER bit required to be set on all modern classes.
private  int accessFlag
          An integer referring to the access permission of the class.
private  JConstantPool cpInfo
          ConstantPool information contained in the class.
private  boolean decompiled
          TRUE if the class was decompiled.
private  java.util.List interfaces
          List of interfaces present in the class.
private  short majorNumber
          Major number of the JVM version that this class file is compiled for.
private  java.util.List memFields
          List of fields present in the class.
private  java.util.List memMethods
          List of methods present in the class.
private  short minorNumber
          Minor number of the JVM version that this class file is compiled for.
private  java.lang.String packageName
          Name of the package of the current class in the JVM format.
private  java.lang.String srcFile
          Name of the source file in which this class files' code is present.
private  java.lang.String superClass
          Name of the current class' superclass in the JVM format.
private  java.lang.String thisClass
          Name of the current class in the JVM format.
 
Fields inherited from interface jreversepro.common.KeyWords
ANY, BOOLEAN, BREAK, BYTE, CASE, CHAR, CLASS, CLASS_STRING, CLINIT, CLOSE_BRACKET, COND_AND, COND_NOT, COND_OR, CONTINUE, DEFAULT, DEFAULT_PACKAGE, DOUBLE, EQUALTO, FALSE, FLOAT, FOREIGN_CLASS, FOREIGN_OBJ, GOTO, INIT, INSTANCEOF, INT, INTERFACE, JVM_BOOLEAN, JVM_CHAR, JVM_VOID, LANG_OBJECT, LENGTH, LONG, NEW, NULL, OPEN_BRACKET, OPR_EQ, OPR_GE, OPR_GT, OPR_LE, OPR_LT, OPR_NE, OPR_NOT, REFERENCE, RET_ADDR, RETURN, SHORT, SPACE, STATIC, SUPER, SWITCH, THIS, THISCLASS, THROW, TRUE, VOID
 
Constructor Summary
JClassInfo()
          Empty constructor
 
Method Summary
 void addField(JField rhsField)
          Adds a new field present in the class.
 void addInterface(java.lang.String interfaceName)
          Adds a new interface that is implemented by this class.
 void addMethod(JMethod rhsMethod)
          Adds a new method present in the class.
 java.lang.String getAccessString()
          Returns the access string of this class.
 JConstantPool getConstantPool()
          Returns the constantpool reference
 java.util.List getFields()
          Returns the fields present in the class.
private  java.lang.StringBuffer getHeaders()
           
 java.util.List getInterfaces()
          Returns the List of interfaces of the current class.
 int getMajor()
          Returns the major number of the JVM.
 java.util.List getMethods()
          Returns the methods of this class.
 int getMinor()
          Returns the minor number of the JVM.
private  java.lang.StringBuffer getPackageImports()
           
 java.lang.String getPathName()
          Returns the path name of this class.
 java.lang.String getSourceFile()
          Returns the source file of the current class.
 java.lang.String getStringifiedClass(boolean getBytecode)
          Returns the stringified disassembled/decompiled class.
 java.lang.String getStringifiedClass(boolean getBytecode, boolean includeMetadata)
          Returns the stringified disassembled/decompiled class, optionally with metadata.
private  java.lang.StringBuffer getStringifiedFields()
           
private  java.lang.StringBuffer getStringifiedInterfaces()
           
 java.lang.String getStringifiedMethods(boolean getBytecode, boolean includeMetadata)
          Returns the stringified disassembled/decompiled method.
 java.lang.String getSuperClass()
          Returns the class name of this class' super class.
 java.lang.String getThisClass()
          Returns the class name of this class.
 java.lang.String getThisClass(boolean fullyQualified)
           
private  java.lang.StringBuffer getThisSuperClasses()
           
 boolean isClass()
          Returns if this is a class or an interface
 void processMethods(boolean getBytecode)
          Process the methods.
 void reverseEngineer(boolean getBytecode)
          Reverse Engineer the Class file.
 void setAccess(int rhsAccess)
          Sets the access flag of the class.
 void setConstantPool(JConstantPool cpInfo)
          Sets the ConstantPool information of this class.
 void setMajorMinor(short rhsMajor, short rhsMinor)
          Sets the major and minor number of the JVM for which this class file is compiled for.
 void setPackageName(java.lang.String packageName)
          Sets the package to which this class belongs to.
 void setPathName(java.lang.String classPath)
          Sets the pathname of this class.
 void setSourceFile(java.lang.String rhsSrcFile)
          Sets the name of the source file to which this was contained in.
 void setSuperClass(java.lang.String rhsName)
          Sets the name of the current class' superclass.
 void setThisClass(java.lang.String rhsName)
          Sets the name of the current class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACC_SUPER

public static final int ACC_SUPER
ACC_SUPER bit required to be set on all modern classes.

See Also:
Constant Field Values

ACC_INTERFACE

public static final int ACC_INTERFACE
ACC_INTERFACE bit required to be set if it is an interface and not a class.

See Also:
Constant Field Values

absPath

private java.lang.String absPath
Absolute path where the class' source file was located.


majorNumber

private short majorNumber
Major number of the JVM version that this class file is compiled for.


minorNumber

private short minorNumber
Minor number of the JVM version that this class file is compiled for.


thisClass

private java.lang.String thisClass
Name of the current class in the JVM format. That is, if the class is String then the name would be java/lang/String.


superClass

private java.lang.String superClass
Name of the current class' superclass in the JVM format. That is, if the class is String then the name would be java/lang/String.


packageName

private java.lang.String packageName
Name of the package of the current class in the JVM format. That is the fully qualified name of the class is java.lang.String. then the package name would contain java/lang.


srcFile

private java.lang.String srcFile
Name of the source file in which this class files' code is present.


cpInfo

private JConstantPool cpInfo
ConstantPool information contained in the class.


decompiled

private boolean decompiled
TRUE if the class was decompiled. False if disasembled.


memFields

private java.util.List memFields
List of fields present in the class. All the members in the list are JField.


memMethods

private java.util.List memMethods
List of methods present in the class. All the members in the list are JMethod.


interfaces

private java.util.List interfaces
List of interfaces present in the class. All the members in the list are String. For example if the class implements java.awt.event.ActionListener then the list would contain java/awt/event/ActionListener as its member. The class file name would be in the JVM format as mentioned above.


accessFlag

private int accessFlag
An integer referring to the access permission of the class. Like if a class is public static void main () then the accessflag would have appropriate bits set to say if it public static.

Constructor Detail

JClassInfo

public JClassInfo()
Empty constructor

Method Detail

addInterface

public void addInterface(java.lang.String interfaceName)
Adds a new interface that is implemented by this class.


addField

public void addField(JField rhsField)
Adds a new field present in the class.


addMethod

public void addMethod(JMethod rhsMethod)
Adds a new method present in the class.


setPathName

public void setPathName(java.lang.String classPath)
Sets the pathname of this class.


setConstantPool

public void setConstantPool(JConstantPool cpInfo)
Sets the ConstantPool information of this class.


getConstantPool

public JConstantPool getConstantPool()
Returns the constantpool reference


setMajorMinor

public void setMajorMinor(short rhsMajor,
                          short rhsMinor)
Sets the major and minor number of the JVM for which this class file is compiled for.


setAccess

public void setAccess(int rhsAccess)
Sets the access flag of the class.


setThisClass

public void setThisClass(java.lang.String rhsName)
Sets the name of the current class.


setSuperClass

public void setSuperClass(java.lang.String rhsName)
Sets the name of the current class' superclass.


setPackageName

public void setPackageName(java.lang.String packageName)
Sets the package to which this class belongs to.


setSourceFile

public void setSourceFile(java.lang.String rhsSrcFile)
Sets the name of the source file to which this was contained in.


getPathName

public java.lang.String getPathName()
Returns the path name of this class.


getMajor

public int getMajor()
Returns the major number of the JVM.


getMinor

public int getMinor()
Returns the minor number of the JVM.


getThisClass

public java.lang.String getThisClass(boolean fullyQualified)

getThisClass

public java.lang.String getThisClass()
Returns the class name of this class.


getSuperClass

public java.lang.String getSuperClass()
Returns the class name of this class' super class.


getSourceFile

public java.lang.String getSourceFile()
Returns the source file of the current class.


getInterfaces

public java.util.List getInterfaces()
Returns the List of interfaces of the current class.


getFields

public java.util.List getFields()
Returns the fields present in the class.


getMethods

public java.util.List getMethods()
Returns the methods of this class.


getAccessString

public java.lang.String getAccessString()
Returns the access string of this class.


isClass

public boolean isClass()
Returns if this is a class or an interface


processMethods

public void processMethods(boolean getBytecode)
Process the methods.


getStringifiedClass

public java.lang.String getStringifiedClass(boolean getBytecode)
Returns the stringified disassembled/decompiled class.


getStringifiedClass

public java.lang.String getStringifiedClass(boolean getBytecode,
                                            boolean includeMetadata)
Returns the stringified disassembled/decompiled class, optionally with metadata.


getStringifiedMethods

public java.lang.String getStringifiedMethods(boolean getBytecode,
                                              boolean includeMetadata)
Returns the stringified disassembled/decompiled method.


getHeaders

private java.lang.StringBuffer getHeaders()

getPackageImports

private java.lang.StringBuffer getPackageImports()

getThisSuperClasses

private java.lang.StringBuffer getThisSuperClasses()

getStringifiedInterfaces

private java.lang.StringBuffer getStringifiedInterfaces()

getStringifiedFields

private java.lang.StringBuffer getStringifiedFields()

reverseEngineer

public void reverseEngineer(boolean getBytecode)
                     throws jreversepro.parser.ClassParserException,
                            jreversepro.revengine.RevEngineException
Reverse Engineer the Class file.