Package org.biojava.bio.program.tagvalue
Class StateMachine.SimpleStateListener
- java.lang.Object
-
- org.biojava.bio.program.tagvalue.StateMachine.SimpleStateListener
-
- All Implemented Interfaces:
TagValueListener
- Enclosing class:
- StateMachine
public class StateMachine.SimpleStateListener extends Object implements TagValueListener
a basic listener for a State. It forwards all events to the delegate for the StateMachine. Extend to implement listeners for specific states.
-
-
Constructor Summary
Constructors Constructor Description SimpleStateListener()
-
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.void
setExceptionOnNullDelegate(boolean throwException)
determines if an exception is thrown when an event arrives without the delegate being set.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.
-
-
-
Constructor Detail
-
SimpleStateListener
public SimpleStateListener()
-
-
Method Detail
-
setExceptionOnNullDelegate
public void setExceptionOnNullDelegate(boolean throwException)
determines if an exception is thrown when an event arrives without the delegate being set. Default is that a ParserException is thrown. i
-
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
-
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
-
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
-
-