net.sf.japaki.text
Class PeekParser<T>

java.lang.Object
  extended by net.sf.japaki.text.AbstractParser<T>
      extended by net.sf.japaki.text.PeekParser<T>
All Implemented Interfaces:
Parser<T>

public class PeekParser<T>
extends AbstractParser<T>

Parses a string without changing the start index.


Constructor Summary
protected PeekParser(Parser<T> parser)
          Creates a new peek parser based on the specified parser.
 
Method Summary
static
<T> Parser<T>
newParser(Parser<T> parser)
          Creates a new peek parser based on the specified parser.
protected  void parseIt(ParseReader in, T target)
          Parse the input text with the base parser.
 String treeView()
          Returns a tree view of this parser.
protected  void writeIt(ParseWriter out, T source)
          Does nothing.
 
Methods inherited from class net.sf.japaki.text.AbstractParser
getLogger, handleException, parse, toString, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PeekParser

protected PeekParser(Parser<T> parser)
Creates a new peek parser based on the specified parser.

Parameters:
parser - base parser
Throws:
NullPointerException - if parser is null
Method Detail

newParser

public static <T> Parser<T> newParser(Parser<T> parser)
Creates a new peek parser based on the specified parser.

Parameters:
parser - base parser
Throws:
NullPointerException - if parser is null

parseIt

protected void parseIt(ParseReader in,
                       T target)
                throws IOException,
                       ParseException
Parse the input text with the base parser. The parse reader is not changed.

Specified by:
parseIt in class AbstractParser<T>
Parameters:
in - the position where to start parsing
target - place where the parsed object is stored.
Throws:
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

writeIt

protected void writeIt(ParseWriter out,
                       T source)
Does nothing.

Specified by:
writeIt in class AbstractParser<T>
Parameters:
out - the stream and position where to put the formatted text.
source - source object

treeView

public String treeView()
Description copied from interface: Parser
Returns a tree view of this parser.

Returns:
a tree view of this parser