com.google.gdata.wireformats.input
Class ElementParser<T>

java.lang.Object
  extended by com.google.gdata.wireformats.input.AbstractParser<T>
      extended by com.google.gdata.wireformats.input.CharacterParser<T>
          extended by com.google.gdata.wireformats.input.ElementParser<T>
All Implemented Interfaces:
InputParser<T>

public class ElementParser<T>
extends CharacterParser<T>

The ElementParser class is a generic InputParser implementation for Element data model types.


Method Summary
static
<T> ElementParser<T>
of(AltFormat altFormat, java.lang.Class<T> resultType)
          Provides a factory method to create a new ElementParser that handles a particular representation to produce a particular type of result.
<R extends T>
R
parse(java.io.Reader inputReader, InputProperties inProps, java.lang.Class<R> resultClass)
          Parses character content with the specified properties to produce a result of an expected type.
 
Methods inherited from class com.google.gdata.wireformats.input.CharacterParser
parse
 
Methods inherited from class com.google.gdata.wireformats.input.AbstractParser
getAltFormat, getResultType
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

of

public static <T> ElementParser<T> of(AltFormat altFormat,
                                      java.lang.Class<T> resultType)
Provides a factory method to create a new ElementParser that handles a particular representation to produce a particular type of result.

Type Parameters:
T - base type of parse result objects
Parameters:
altFormat - alternate representation parsed
resultType - type of result object produced
Returns:
an element parser with the desired configuration
Throws:
java.lang.IllegalArgumentException - if the representation does not have an associated wire format that can be used to parse the content.

parse

public <R extends T> R parse(java.io.Reader inputReader,
                             InputProperties inProps,
                             java.lang.Class<R> resultClass)
                  throws java.io.IOException,
                         ServiceException
Description copied from class: CharacterParser
Parses character content with the specified properties to produce a result of an expected type. Concrete subclasses will provide an implementation of this method that constructs a result type instance of the result class and then parses into it from the provided Reader.

Specified by:
parse in class CharacterParser<T>
Type Parameters:
R - expected result type
Parameters:
inputReader - reader to parse data from
inProps - input properties
resultClass - class to instantiate and parse result into.
Returns:
result object from parse
Throws:
java.io.IOException - if an error occurred reading data while parsing
ServiceException - if an error occurred within the content