public abstract class AbstractParser<T> extends 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 Class<? extends T> |
resultType |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractParser(AltFormat altFormat,
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(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.
|
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, waitparseprotected final AltFormat altFormat
public AltFormat getAltFormat()
InputParsergetAltFormat in interface InputParser<T>public Class<? extends T> getResultType()
InputParsergetResultType in interface InputParser<T>protected T createResult() throws ContentCreationException
ContentCreationExceptionprotected <R extends T> R createResult(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 objectCopyright © 2012. All Rights Reserved.