public abstract class AbstractParser<T> extends java.lang.Object implements InputParser<T>
InputParser
implementations. It provides the
basic storage and getters for the alternate representation and result type
and utility code for constructing new result type implementation instances.Modifier and Type | Field and Description |
---|---|
protected AltFormat |
altFormat |
protected java.lang.Class<? extends T> |
resultType |
Modifier | Constructor and Description |
---|---|
protected |
AbstractParser(AltFormat altFormat,
java.lang.Class<? extends T> resultType)
Constructs a new AbstractParser instance for the specified representation
and result type.
|
Modifier and Type | Method and Description |
---|---|
protected T |
createResult()
Creates a new result object instance using the result type passed to
the constructor.
|
protected <R extends T> |
createResult(java.lang.Class<R> resultImplClass)
Creates a new result object instance using the provided result
implementation class.
|
AltFormat |
getAltFormat()
Returns the alternate representation format that is expected as input to
the parser.
|
java.lang.Class<? extends T> |
getResultType()
Returns the target type that is populated by the parser from the input
stream.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
parse
protected final AltFormat altFormat
protected final java.lang.Class<? extends T> resultType
public AltFormat getAltFormat()
InputParser
getAltFormat
in interface InputParser<T>
public java.lang.Class<? extends T> getResultType()
InputParser
getResultType
in interface InputParser<T>
protected T createResult() throws ContentCreationException
ContentCreationException
protected <R extends T> R createResult(java.lang.Class<R> resultImplClass) throws ContentCreationException
R
- type of the created resultresultImplClass
- Result implementation class. The type must implement
the result type of the parser and provide a null argument
constructor.ContentCreationException
- if unable to create result object