com.objectwave.sourceParser
Class ClassSpecParser

java.lang.Object
  |
  +--com.objectwave.sourceParser.ClassSpecParser
All Implemented Interfaces:
ClassParser

public class ClassSpecParser
extends java.lang.Object
implements ClassParser

Parse java source code for a class definition.

Version:
2.0
Author:
Dave Hoag

Constructor Summary
ClassSpecParser()
           
 
Method Summary
static ClassParser[] allNextParsers()
          All the elements that could be part of a Class definition (between the '{' and '}' in a class definition).
static void determinePieces(ClassSpec anObject, java.io.Reader rdr, java.util.Vector elements)
          We are now parsing code that is found within a class definition.
 void finishParsing(java.lang.StringBuffer buf, java.lang.String[] identifier, java.io.Reader rdr)
          Attempt to successfully complete the parsing of a class definition.
 ClassElement getDataObject()
          When we have finished parsing, the resulting ClassElement returned by getDataObject should represent our meta-model of that element.
 boolean isMyArea(java.lang.String identifier)
          When parsing source code we never know what ClassElement will be next, so we ask all possible class elements isMyArea(String) for one of them to say yes.
static void main(java.lang.String[] argv)
          Test Routine
protected  void updateContents(ClassElement[] contents)
          If theObject is an interface, the methods are all public and abstract.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassSpecParser

public ClassSpecParser()
Method Detail

allNextParsers

public static ClassParser[] allNextParsers()
All the elements that could be part of a Class definition (between the '{' and '}' in a class definition).


determinePieces

public static void determinePieces(ClassSpec anObject,
                                   java.io.Reader rdr,
                                   java.util.Vector elements)
                            throws java.io.IOException
We are now parsing code that is found within a class definition. This will determine all of the class elements found within this class definition.

java.io.IOException

finishParsing

public void finishParsing(java.lang.StringBuffer buf,
                          java.lang.String[] identifier,
                          java.io.Reader rdr)
                   throws java.io.IOException
Attempt to successfully complete the parsing of a class definition. This includes the extends and implements elements, as well as the full class body.

Specified by:
finishParsing in interface ClassParser
java.io.IOException

updateContents

protected void updateContents(ClassElement[] contents)
If theObject is an interface, the methods are all public and abstract.

Parameters:
contents - All of the elements make up the body of the class or interface.

getDataObject

public ClassElement getDataObject()
Description copied from interface: ClassParser
When we have finished parsing, the resulting ClassElement returned by getDataObject should represent our meta-model of that element.

Specified by:
getDataObject in interface ClassParser
Returns:
ClassSpec The element this parser is used to build.

isMyArea

public boolean isMyArea(java.lang.String identifier)
When parsing source code we never know what ClassElement will be next, so we ask all possible class elements isMyArea(String) for one of them to say yes. Once one of the parser acknowledges ownership, we hand off the parsing routine to that class parser.

Specified by:
isMyArea in interface ClassParser
See Also:
finishParsing(java.lang.StringBuffer, java.lang.String[], java.io.Reader)

main

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