public class ValueChanger extends SimpleTagValueWrapper
Intercept the values associated with some tags and change them systematically.
The two forms of changes that can be made are:
For a given tag, changers take precendence over splitters, and explicitly registered changers or splitters take precendence over the default handlers. If there is not a specific handler for a tag and there is no default set, then the value is passed on unchanged.
| Constructor and Description |
|---|
ValueChanger(TagValueListener delegate) |
ValueChanger(TagValueListener delegate,
ChangeTable changeTable)
Create a new changer that will pass the modified event stream to a
delegate.
|
| Modifier and Type | Method and Description |
|---|---|
ChangeTable |
getChangeTable() |
ChangeTable.Changer |
getDefaultChanger()
Get the changer that will be applied to values of tags with no specific
handler registered.
|
ChangeTable.Splitter |
getDefaultSplitter()
Get the splitter that will be applied to values of tags with no specific
handler registered.
|
void |
setChangeTable(ChangeTable changeTable) |
void |
setDefaultChanger(ChangeTable.Changer c)
The changer that will be applied to the values of tags not registered
explicitly to any changer or splitter instance.
|
void |
setDefaultSplitter(ChangeTable.Splitter s)
The splitter that will be applied to the values of tags not registered
explicitly to any changer or splitter instance.
|
void |
startTag(java.lang.Object tag)
Start a new tag.
|
void |
value(TagValueContext ctxt,
java.lang.Object value)
A value has been seen.
|
endRecord, endTag, getDelegate, setDelegate, startRecordpublic ValueChanger(TagValueListener delegate)
public ValueChanger(TagValueListener delegate, ChangeTable changeTable)
delegate - the TagValueListener that will receive the eventspublic void setDefaultChanger(ChangeTable.Changer c)
c - the default ChangeTable.Changerpublic ChangeTable.Changer getDefaultChanger()
public void setDefaultSplitter(ChangeTable.Splitter s)
s - the default ChangeTable.Splitterpublic ChangeTable.Splitter getDefaultSplitter()
public ChangeTable getChangeTable()
public void setChangeTable(ChangeTable changeTable)
public void startTag(java.lang.Object tag)
throws ParserException
TagValueListenerstartTag in interface TagValueListenerstartTag in class SimpleTagValueWrappertag - the Object representing the new tagParserException - if the tag could not be startedpublic void value(TagValueContext ctxt, java.lang.Object value) throws ParserException
TagValueListenervalue in interface TagValueListenervalue in class SimpleTagValueWrapperctxt - a TagValueContext that could be used to push a sub-documentvalue - the value Object observedParserException - if the value could not be processed