public class PlaceHolderGroup extends java.lang.Object implements StructGroup
This group is intended to parse a Single line or block of text to an Object which is already located in memory, while the normal StructGroup implementations create new instances of Objects
MAP, XML| Constructor and Description |
|---|
PlaceHolderGroup(java.lang.Object o)
Constructor for PlaceHolderGroup.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(StructRule rule)
add a rule to this Group.
|
java.lang.Object |
getObject()
get the Object created as a result of the input matching
this group.
|
int |
getOutputType()
the type of output
StructGroup.getObject() will deliver if the
rules are matched to the output |
java.util.List |
getTransformats()
get the List of Transformats added to this Group.
|
boolean |
isFinished()
check if the end of this group is found in the input
|
boolean |
isFound()
check if the beginning of this group is found.
|
void |
readline(java.lang.String line)
read a line from the parser for processing, without
tracking the line number
|
void |
readline(java.lang.String line,
int lineno)
read a line from the parser for processing, with
tracking the line number
|
void |
reset()
reset this group to a state were the input
can be processed from the beginning.
|
void |
setParent(StructGroup group)
set the parent for this Group
|
public PlaceHolderGroup(java.lang.Object o)
o - Object, the object to add the results
of the rules to.public boolean isFinished()
isFinished in interface StructGroupStructGroup.isFound()public boolean isFound()
All input will be processed inside this group as long as isFinished is false
isFound in interface StructGroupStructGroup.isFinished()public void readline(java.lang.String line)
The StructParser supplies the input line for line. This
does not limit the rules to one line. This is only dependant
on StructGroup.isFound() and StructGroup.isFinished()
This method calls StructGroup.readline(String, int) with lineno=-1
and will ignore lineno for information purposes
readline in interface StructGroupline - String, the line to be readStructGroup.readline(String, int),
StructParserpublic void readline(java.lang.String line,
int lineno)
The StructParser supplies the input line for line. This
does not limit the rules to one line. This is only dependant
on StructGroup.isFound() and StructGroup.isFinished()
readline in interface StructGroupline - String, the line to be readlineno - int, the linenumber of this lineStructParserpublic void add(StructRule rule)
StructGroup.isFound() is true and until StructGroup.isFinished()
is true.add in interface StructGrouprule - StructRule, the rule to add to this grouppublic java.lang.Object getObject()
getObject in interface StructGroupStructGroup.isFound() is never true
for this group and might not be correctly set if StructGroup.isFinished() never is truepublic int getOutputType()
StructGroup.getObject() will deliver if the
rules are matched to the outputgetOutputType in interface StructGrouppublic java.util.List getTransformats()
A transformater is a class which will be called to
format the values from an input to a value for the output.
With an implementation one can do simple transformations
SimpleTransformat like trimming whitespaces or
setting the value to uppercase or do complex transformations
ComplexTransformat changing multiple values
in a resulting Object
For SimpleTransformat adding this to the group
will mean this rule will be applied to all rules added to
this group
getTransformats in interface StructGroupTransformatpublic void reset()
This method is called to reuse this Group for subsequent calls after a group has finished clearing all data related to previous matching of this group.
After calling reset StructGroup.isFound() and StructGroup.isFinished()
should both be false and StructGroup.getObject() should return null
reset in interface StructGrouppublic void setParent(StructGroup group)
StructGroupsetParent in interface StructGroupgroup - StructGroup the parent to use