public abstract class SimpleTagValueWrapper extends Object implements TagValueWrapper
Helper class to wrap one TagValueListener inside another one.
Implementations will tend to intercept the tags or values as they stream through and modify them in some manner before forwarding them to the delegate listener. Using classes derived from SimpleTagValueWrapper, it is possible to build up complex chains of handlers that process and collate information as it streams through.
Constructor and Description |
---|
SimpleTagValueWrapper() |
SimpleTagValueWrapper(TagValueListener delegate)
Build a SimpleTagValueWrapper that will forward everything to a delegate.
|
Modifier and Type | Method and Description |
---|---|
void |
endRecord()
The current record has ended.
|
void |
endTag()
End the current tag.
|
TagValueListener |
getDelegate()
get listener to which all calls will be delegated
|
void |
setDelegate(TagValueListener delegate)
set listener to which all calls will be delegated
|
void |
startRecord()
A new record is about to start.
|
void |
startTag(Object tag)
Start a new tag.
|
void |
value(TagValueContext ctxt,
Object value)
A value has been seen.
|
public SimpleTagValueWrapper(TagValueListener delegate)
delegate
- the SimpleTagValueWrapper to forward events topublic SimpleTagValueWrapper()
public TagValueListener getDelegate()
TagValueWrapper
getDelegate
in interface TagValueWrapper
public void setDelegate(TagValueListener delegate)
TagValueWrapper
setDelegate
in interface TagValueWrapper
public void startRecord() throws ParserException
TagValueListener
startRecord
in interface TagValueListener
ParserException
- if the record can not be startedpublic void endRecord() throws ParserException
TagValueListener
endRecord
in interface TagValueListener
ParserException
- if the record can not be endedpublic void startTag(Object tag) throws ParserException
TagValueListener
startTag
in interface TagValueListener
tag
- the Object representing the new tagParserException
- if the tag could not be startedpublic void endTag() throws ParserException
TagValueListener
endTag
in interface TagValueListener
ParserException
- if the tag could not be endedpublic void value(TagValueContext ctxt, Object value) throws ParserException
TagValueListener
value
in interface TagValueListener
ctxt
- a TagValueContext that could be used to push a sub-documentvalue
- the value Object observedParserException
- if the value could not be processedCopyright © 2020 BioJava. All rights reserved.