public abstract class

AbstractParser

extends Object
implements InputParser<T>
java.lang.Object
   ↳ com.google.gdata.wireformats.input.AbstractParser<T>
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

The AbstractParser class is an abstract base class that can be used in the creation of new 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.

Summary

Fields
protected final AltFormat altFormat
protected final Class<? extends T> resultType
Protected Constructors
AbstractParser(AltFormat altFormat, Class<? extends T> resultType)
Constructs a new AbstractParser instance for the specified representation and result type.
Public Methods
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.
Protected Methods
<R extends T> R createResult(Class<R> resultImplClass)
Creates a new result object instance using the provided result implementation class.
T createResult()
Creates a new result object instance using the result type passed to the constructor.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.google.gdata.wireformats.input.InputParser

Fields

protected final AltFormat altFormat

protected final Class<? extends T> resultType

Protected Constructors

protected AbstractParser (AltFormat altFormat, Class<? extends T> resultType)

Constructs a new AbstractParser instance for the specified representation and result type.

Parameters
altFormat Parsed alternate representation
resultType Type of result

Public Methods

public AltFormat getAltFormat ()

Returns the alternate representation format that is expected as input to the parser.

public Class<? extends T> getResultType ()

Returns the target type that is populated by the parser from the input stream.

Protected Methods

protected R createResult (Class<R> resultImplClass)

Creates a new result object instance using the provided result implementation class. This form can be used by subclasses where the result type is an interface or where results may be an implementation class that is a subclass of the result type.

Parameters
resultImplClass Result implementation class. The type must implement the result type of the parser and provide a null argument constructor.
Returns
  • result instance
Throws
ContentCreationException if unable to create result object

protected T createResult ()

Creates a new result object instance using the result type passed to the constructor. This form can be used by subclasses where the result type is a concrete implementation class.

Returns
  • result instance