Package org.biojava.bio.program.tagvalue
Class SimpleTagValueWrapper
- java.lang.Object
-
- org.biojava.bio.program.tagvalue.SimpleTagValueWrapper
-
- All Implemented Interfaces:
TagValueListener
,TagValueWrapper
- Direct Known Subclasses:
Aggregator
,MultiTagger
,RegexFieldFinder
,TagDelegator
,TagDropper
,TagRenamer
,ValueChanger
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.
- Since:
- 1.2
- Author:
- Matthew Pocock, David Huen (change of TagValueWrapper to interface)
-
-
Constructor Summary
Constructors Constructor Description SimpleTagValueWrapper()
SimpleTagValueWrapper(TagValueListener delegate)
Build a SimpleTagValueWrapper that will forward everything to a delegate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
endRecord()
The current record has ended.void
endTag()
End the current tag.TagValueListener
getDelegate()
get listener to which all calls will be delegatedvoid
setDelegate(TagValueListener delegate)
set listener to which all calls will be delegatedvoid
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.
-
-
-
Constructor Detail
-
SimpleTagValueWrapper
public SimpleTagValueWrapper(TagValueListener delegate)
Build a SimpleTagValueWrapper that will forward everything to a delegate.- Parameters:
delegate
- the SimpleTagValueWrapper to forward events to
-
SimpleTagValueWrapper
public SimpleTagValueWrapper()
-
-
Method Detail
-
getDelegate
public TagValueListener getDelegate()
Description copied from interface:TagValueWrapper
get listener to which all calls will be delegated- Specified by:
getDelegate
in interfaceTagValueWrapper
-
setDelegate
public void setDelegate(TagValueListener delegate)
Description copied from interface:TagValueWrapper
set listener to which all calls will be delegated- Specified by:
setDelegate
in interfaceTagValueWrapper
-
startRecord
public void startRecord() throws ParserException
Description copied from interface:TagValueListener
A new record is about to start.- Specified by:
startRecord
in interfaceTagValueListener
- Throws:
ParserException
- if the record can not be started
-
endRecord
public void endRecord() throws ParserException
Description copied from interface:TagValueListener
The current record has ended.- Specified by:
endRecord
in interfaceTagValueListener
- Throws:
ParserException
- if the record can not be ended
-
startTag
public void startTag(Object tag) throws ParserException
Description copied from interface:TagValueListener
Start a new tag.- Specified by:
startTag
in interfaceTagValueListener
- Parameters:
tag
- the Object representing the new tag- Throws:
ParserException
- if the tag could not be started
-
endTag
public void endTag() throws ParserException
Description copied from interface:TagValueListener
End the current tag.- Specified by:
endTag
in interfaceTagValueListener
- Throws:
ParserException
- if the tag could not be ended
-
value
public void value(TagValueContext ctxt, Object value) throws ParserException
Description copied from interface:TagValueListener
A value has been seen.- Specified by:
value
in interfaceTagValueListener
- Parameters:
ctxt
- a TagValueContext that could be used to push a sub-documentvalue
- the value Object observed- Throws:
ParserException
- if the value could not be processed
-
-