jdepend.framework
Class JavaClassFileParser

java.lang.Object
  extended byjdepend.framework.AbstractParser
      extended byjdepend.framework.JavaClassFileParser

public class JavaClassFileParser
extends AbstractParser

The JavaClassFileParser class is responsible for parsing a Java class file to create a JavaClass instance.

Author:
Mike Clark, Clarkware Consulting, Inc.

Field Summary
static int ACC_ABSTRACT
           
static int ACC_INTERFACE
           
static char CLASS_DESCRIPTOR
           
static int CONSTANT_CLASS
           
static int CONSTANT_DOUBLE
           
static int CONSTANT_FIELD
           
static int CONSTANT_FLOAT
           
static int CONSTANT_INTEGER
           
static int CONSTANT_INTERFACEMETHOD
           
static int CONSTANT_LONG
           
static int CONSTANT_METHOD
           
static int CONSTANT_NAMEANDTYPE
           
static int CONSTANT_STRING
           
static int CONSTANT_UNICODE
           
static int CONSTANT_UTF8
           
static int JAVA_MAGIC
           
 
Fields inherited from class jdepend.framework.AbstractParser
DEBUG
 
Constructor Summary
JavaClassFileParser()
          Constructs a JavaClassFileParser instance with the default package filter.
JavaClassFileParser(PackageFilter filter)
          Constructs a JavaClassFileParser instance with the specified package filter.
 
Method Summary
protected  void addClassConstantReferences()
           
protected  java.lang.String getClassConstantName(int entryIndex)
           
protected  java.lang.String getClassName()
           
protected  jdepend.framework.JavaClassFileParser.Constant getConstantPoolEntry(int entryIndex)
           
protected  java.util.Collection getImports()
           
protected  java.lang.String[] getInterfaceNames()
           
protected  java.lang.String getSuperClassName()
           
protected  boolean isAbstract()
           
static void main(java.lang.String[] args)
          Test main.
protected  JavaClass parse(java.io.InputStream is)
           
 JavaClass parse(java.lang.String filename)
          Parses the specified Java class file and returns a representative JavaClass instance.
protected  void parseAccessFlags()
           
protected  void parseAttribute()
           
protected  void parseClassName()
           
protected  jdepend.framework.JavaClassFileParser.Constant parseConstant()
           
protected  void parseConstantPool()
           
protected  jdepend.framework.JavaClassFileParser.FieldOrMethodInfo parseFieldOrMethodInfo()
           
protected  void parseFields()
           
protected  void parseInterfaces()
           
protected  void parseMagic()
           
protected  void parseMethods()
           
protected  void parseSuperClassName()
           
protected  void parseVersion()
           
protected  void reset()
           
 java.lang.String toString()
          Returns a string representation of this object.
protected  java.lang.String toUTF8(int entryIndex)
           
 
Methods inherited from class jdepend.framework.AbstractParser
addParseListener, debug, getFilter, onParsedJavaClass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

JAVA_MAGIC

public static final int JAVA_MAGIC
See Also:
Constant Field Values

CONSTANT_UTF8

public static final int CONSTANT_UTF8
See Also:
Constant Field Values

CONSTANT_UNICODE

public static final int CONSTANT_UNICODE
See Also:
Constant Field Values

CONSTANT_INTEGER

public static final int CONSTANT_INTEGER
See Also:
Constant Field Values

CONSTANT_FLOAT

public static final int CONSTANT_FLOAT
See Also:
Constant Field Values

CONSTANT_LONG

public static final int CONSTANT_LONG
See Also:
Constant Field Values

CONSTANT_DOUBLE

public static final int CONSTANT_DOUBLE
See Also:
Constant Field Values

CONSTANT_CLASS

public static final int CONSTANT_CLASS
See Also:
Constant Field Values

CONSTANT_STRING

public static final int CONSTANT_STRING
See Also:
Constant Field Values

CONSTANT_FIELD

public static final int CONSTANT_FIELD
See Also:
Constant Field Values

CONSTANT_METHOD

public static final int CONSTANT_METHOD
See Also:
Constant Field Values

CONSTANT_INTERFACEMETHOD

public static final int CONSTANT_INTERFACEMETHOD
See Also:
Constant Field Values

CONSTANT_NAMEANDTYPE

public static final int CONSTANT_NAMEANDTYPE
See Also:
Constant Field Values

CLASS_DESCRIPTOR

public static final char CLASS_DESCRIPTOR
See Also:
Constant Field Values

ACC_INTERFACE

public static final int ACC_INTERFACE
See Also:
Constant Field Values

ACC_ABSTRACT

public static final int ACC_ABSTRACT
See Also:
Constant Field Values
Constructor Detail

JavaClassFileParser

public JavaClassFileParser()
Constructs a JavaClassFileParser instance with the default package filter.


JavaClassFileParser

public JavaClassFileParser(PackageFilter filter)
Constructs a JavaClassFileParser instance with the specified package filter.

Parameters:
filter - Package filter.
Method Detail

reset

protected void reset()

parse

public JavaClass parse(java.lang.String filename)
                throws java.io.IOException
Parses the specified Java class file and returns a representative JavaClass instance.

Registered parser listeners are informed that the resulting JavaClass was parsed.

Specified by:
parse in class AbstractParser
Parameters:
filename - Java class file name.
Returns:
Java class.
Throws:
java.io.IOException - If the file could not be parsed.

parse

protected JavaClass parse(java.io.InputStream is)
                   throws java.io.IOException
Throws:
java.io.IOException

parseMagic

protected void parseMagic()
                   throws java.io.IOException
Throws:
java.io.IOException

parseVersion

protected void parseVersion()
                     throws java.io.IOException
Throws:
java.io.IOException

parseConstantPool

protected void parseConstantPool()
                          throws java.io.IOException
Throws:
java.io.IOException

parseAccessFlags

protected void parseAccessFlags()
                         throws java.io.IOException
Throws:
java.io.IOException

parseClassName

protected void parseClassName()
                       throws java.io.IOException
Throws:
java.io.IOException

parseSuperClassName

protected void parseSuperClassName()
                            throws java.io.IOException
Throws:
java.io.IOException

parseInterfaces

protected void parseInterfaces()
                        throws java.io.IOException
Throws:
java.io.IOException

parseFields

protected void parseFields()
                    throws java.io.IOException
Throws:
java.io.IOException

parseMethods

protected void parseMethods()
                     throws java.io.IOException
Throws:
java.io.IOException

parseConstant

protected jdepend.framework.JavaClassFileParser.Constant parseConstant()
                                                                throws java.io.IOException
Throws:
java.io.IOException

parseFieldOrMethodInfo

protected jdepend.framework.JavaClassFileParser.FieldOrMethodInfo parseFieldOrMethodInfo()
                                                                                  throws java.io.IOException
Throws:
java.io.IOException

parseAttribute

protected void parseAttribute()
                       throws java.io.IOException
Throws:
java.io.IOException

getConstantPoolEntry

protected jdepend.framework.JavaClassFileParser.Constant getConstantPoolEntry(int entryIndex)
                                                                       throws java.io.IOException
Throws:
java.io.IOException

addClassConstantReferences

protected void addClassConstantReferences()
                                   throws java.io.IOException
Throws:
java.io.IOException

getClassConstantName

protected java.lang.String getClassConstantName(int entryIndex)
                                         throws java.io.IOException
Throws:
java.io.IOException

toUTF8

protected java.lang.String toUTF8(int entryIndex)
                           throws java.io.IOException
Throws:
java.io.IOException

isAbstract

protected boolean isAbstract()

getClassName

protected java.lang.String getClassName()

getSuperClassName

protected java.lang.String getSuperClassName()

getInterfaceNames

protected java.lang.String[] getInterfaceNames()

getImports

protected java.util.Collection getImports()

toString

public java.lang.String toString()
Returns a string representation of this object.

Returns:
String representation.

main

public static void main(java.lang.String[] args)
Test main.



Copyright ? 1999-2002 Clarkware Consulting, Inc. All Rights Reserved.