net.sf.japaki.text
Interface Parser<T>

All Known Implementing Classes:
AbstractParser, BeanParser, ChoiceParser, CollectionParser, LeafParser, LineFeed, MapParser, OptionalParser, PeekParser, PropertyParser

public interface Parser<T>

A parser transforms an object into a string and vice versa. It is based on Format, but uses an abstract position and generics.


Method Summary
 void parse(ParseReader in, T target)
          Parses text starting at the specified position.
 String treeView()
          Returns a tree view of this parser.
 void write(ParseWriter out, T source)
          Formats the source object and writes it into the output stream
 

Method Detail

parse

void parse(ParseReader in,
           T target)
           throws IOException,
                  ParseException
Parses text starting at the specified position.

Parameters:
in - the position where to start parsing
target - place where the parsed object is stored.
Throws:
ClassCastException - if generics rules are violated
NullPointerException - if in or target or one of its (sub-) properties is null and the parser cannot handle it
BeanStoreException - if the parsed value could not be stored
IOException - if an I/O error occurs
ParseException - if the beginning of the string in in cannot be parsed

write

void write(ParseWriter out,
           T source)
           throws IOException,
                  FormatException
Formats the source object and writes it into the output stream

Parameters:
out - the stream and position where to put the formatted text.
source - source object
Throws:
ClassCastException - if generics rules are violated
NullPointerException - if out is null
IOException - if an I/O error occurs
FormatException - if the source object can not be formatted with this parser.

treeView

String treeView()
Returns a tree view of this parser.

Returns:
a tree view of this parser