com.google.api.client.googleapis.json
Class JsonFeedParser<T,I>

java.lang.Object
  extended by com.google.api.client.googleapis.json.AbstractJsonFeedParser<T>
      extended by com.google.api.client.googleapis.json.JsonFeedParser<T,I>
Type Parameters:
T - feed type
I - item type

public final class JsonFeedParser<T,I>
extends AbstractJsonFeedParser<T>

Google JSON-C feed parser when the item class is known in advance.

Since:
1.0
Author:
Yaniv Inbar

Constructor Summary
JsonFeedParser(com.google.api.client.json.JsonParser parser, Class<T> feedClass, Class<I> itemClass)
           
 
Method Summary
 I parseNextItem()
          Parse the next item in the feed and return a new parsed instance of the item class.
static
<T,I> JsonFeedParser<T,I>
use(com.google.api.client.json.JsonFactory jsonFactory, com.google.api.client.http.HttpResponse response, Class<T> feedClass, Class<I> itemClass)
          Parses the given HTTP response using the given feed class and item class.
 
Methods inherited from class com.google.api.client.googleapis.json.AbstractJsonFeedParser
close, parseFeed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsonFeedParser

public JsonFeedParser(com.google.api.client.json.JsonParser parser,
                      Class<T> feedClass,
                      Class<I> itemClass)
Parameters:
parser - JSON parser
feedClass - feed class
itemClass - item class
Method Detail

parseNextItem

public I parseNextItem()
                throws IOException
Description copied from class: AbstractJsonFeedParser
Parse the next item in the feed and return a new parsed instance of the item class. If there is no item to parse, it will return null and automatically close the parser (in which case there is no need to call AbstractJsonFeedParser.close().

Overrides:
parseNextItem in class AbstractJsonFeedParser<T>
Throws:
IOException

use

public static <T,I> JsonFeedParser<T,I> use(com.google.api.client.json.JsonFactory jsonFactory,
                                            com.google.api.client.http.HttpResponse response,
                                            Class<T> feedClass,
                                            Class<I> itemClass)
                               throws IOException
Parses the given HTTP response using the given feed class and item class.

Parameters:
jsonFactory - JSON factory
response - HTTP response
feedClass - feed class
itemClass - item class
Throws:
IOException
Since:
1.3


Copyright © 2010-2011 Google. All Rights Reserved.