|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.japaki.text.AbstractParser<B>
net.sf.japaki.text.BeanParser<B>
public class BeanParser<B>
A parser for a bean.
For every relevant property a parser must be specified,
the sequence of properties is defined by the sequence of parsers.
It can also be used for any sequence of parsers of the same type.
| Constructor Summary | |
|---|---|
protected |
BeanParser(List<Parser<? super B>> parsers,
String name)
Creates a new bean parser based on the specified parsers. |
| Method Summary | ||
|---|---|---|
static
|
newParser(List<Parser<? super B>> parsers,
String name)
Creates a new bean parser based on the specified parsers. |
|
static
|
newParser(List<Parser<? super B>> parsers,
String name,
Parser<? super B> delimiterParser)
Creates a new bean parser based on the specified parsers. |
|
protected void |
parseIt(ParseReader in,
B target)
Uses the underlying parsers to parse the input stream and stores the values in the target bean. |
|
String |
treeView()
Returns a tree view of this parser. |
|
protected void |
writeIt(ParseWriter out,
B source)
Formats the bean using the underlying parsers. |
|
| 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 |
|---|
protected BeanParser(List<Parser<? super B>> parsers,
String name)
parsers - property parsersname - name of this parser for logging purposes
NullPointerException - if parsers or name
is null| Method Detail |
|---|
public static <B> Parser<B> newParser(List<Parser<? super B>> parsers,
String name)
parsers - property parsersname - name of this parser for logging purposes
NullPointerException - if parsers or name
is null
public static <B> Parser<B> newParser(List<Parser<? super B>> parsers,
String name,
Parser<? super B> delimiterParser)
parsers - property parsersname - name of this parser for logging purposesdelimiterParser - parser for tokens between elements
NullPointerException - if parsers or name
is null
protected void parseIt(ParseReader in,
B target)
throws IOException,
ParseException
parseIt in class AbstractParser<B>target - target beanin - the position where to start parsing
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
protected void writeIt(ParseWriter out,
B source)
throws IOException,
FormatException
writeIt in class AbstractParser<B>source - source beanout - the stream and position where to put the formatted text.
NullPointerException - if out is null
IOException - if an I/O error occurs
FormatException - if the source object can not be formatted with
this parser.public String treeView()
Parser
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||