public class TagDelegator extends SimpleTagValueWrapper
Pushes a new parser and listener, or delegate to a listener depending on the tag.
setParserListener() is used to associate a tag with a TagValueParser and TagValueListener. When this tag is encountered, the pair will be pushed onto the parser processing stack and will gain control of the stream until that tag has ended. setListener() is used to associate a listener with a tag that will be used to handle those values without pushing a sub-context. The delegator is constructed with a default TagValueListener that will be informed of all events for which there are no explicit delegate pairs registered.
Constructor and Description |
---|
TagDelegator() |
TagDelegator(TagValueListener delegate) |
Modifier and Type | Method and Description |
---|---|
void |
endTag()
End the current tag.
|
TagValueParser |
getDelegateParser() |
TagValueListener |
getListener(Object tag) |
TagValueParser |
getParser(Object tag) |
Set |
getTags() |
void |
setDelegateParser(TagValueParser delegateParser) |
void |
setListener(Object tag,
TagValueListener listener) |
void |
setParserListener(Object tag,
TagValueParser parser,
TagValueListener listener) |
void |
startTag(Object tag)
Start a new tag.
|
void |
value(TagValueContext tvc,
Object value)
A value has been seen.
|
endRecord, getDelegate, setDelegate, startRecord
public TagDelegator()
public TagDelegator(TagValueListener delegate)
public void setDelegateParser(TagValueParser delegateParser)
public TagValueParser getDelegateParser()
public void startTag(Object tag) throws ParserException
TagValueListener
startTag
in interface TagValueListener
startTag
in class SimpleTagValueWrapper
tag
- the Object representing the new tagParserException
- if the tag could not be startedpublic void endTag() throws ParserException
TagValueListener
endTag
in interface TagValueListener
endTag
in class SimpleTagValueWrapper
ParserException
- if the tag could not be endedpublic void value(TagValueContext tvc, Object value) throws ParserException
TagValueListener
value
in interface TagValueListener
value
in class SimpleTagValueWrapper
tvc
- a TagValueContext that could be used to push a sub-documentvalue
- the value Object observedParserException
- if the value could not be processedpublic void setParserListener(Object tag, TagValueParser parser, TagValueListener listener)
public void setListener(Object tag, TagValueListener listener)
public TagValueParser getParser(Object tag)
public TagValueListener getListener(Object tag)
Copyright © 2020 BioJava. All rights reserved.