ESC/Java2
© 2003,2004,2005 David Cok and Joseph Kiniry
© 2005 UCD Dublin
© 2003,2004 Radboud University Nijmegen
© 1999,2000 Compaq Computer Corporation
© 1997,1998,1999 Digital Equipment Corporation
All Rights Reserved

javafe.reader
Class Reader

java.lang.Object
  extended byjavafe.reader.Reader
Direct Known Subclasses:
BinReader, CachedReader, SrcReader, TypeReader

public abstract class Reader
extends java.lang.Object

A Reader is an object that reads then parses a GenericFile, returning a CompilationUnit. Iff problems arise, errors will be reported via ErrorSet and then null will be returned.

Readers may or may not cache the results of their reading.

The class CachedReader can be used to turn a noncaching Reader into a caching Reader.


Constructor Summary
Reader()
           
 
Method Summary
abstract  CompilationUnit read(GenericFile target, boolean avoidSpec)
          Attempt to read and parse a CompilationUnit from target.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Reader

public Reader()
Method Detail

read

public abstract CompilationUnit read(GenericFile target,
                                     boolean avoidSpec)
Attempt to read and parse a CompilationUnit from target. Any errors encountered are reported via javafe.util.ErrorSet. Null is returned iff an error was encountered.

By default, we attempt to read only a spec (e.g., specOnly is set in the resulting CompilationUnit) to save time. If avoidSpec is true, we attempt to return a non-spec, although this may not always be possible.

The result of this function may or may not be cached.

If it is cached, then only the value of avoidSpec used the first time a given file is read is used. This may result in a spec being returned unnecessarily when avoidSpec is true.

Target must be non-null.

Parameters:
target - The source to be read
avoidSpec - If true, then bodies are parsed as well, if possible; if false, no method bodies are parsed.
Returns:
The resulting compilation unit, or null if an error occurred during parsing

ESC/Java2
© 2003,2004,2005 David Cok and Joseph Kiniry
© 2005 UCD Dublin
© 2003,2004 Radboud University Nijmegen
© 1999,2000 Compaq Computer Corporation
© 1997,1998,1999 Digital Equipment Corporation
All Rights Reserved

The ESC/Java2 Project Homepage