com.google.api.client.http.xml.atom
Class AtomContent

java.lang.Object
  extended by com.google.api.client.http.AbstractHttpContent
      extended by com.google.api.client.http.xml.AbstractXmlHttpContent
          extended by com.google.api.client.http.xml.atom.AtomContent
All Implemented Interfaces:
HttpContent

public class AtomContent
extends AbstractXmlHttpContent

Serializes Atom XML HTTP content based on the data key/value mapping object for an Atom entry.

Default value for AbstractXmlHttpContent.getType() is Atom.CONTENT_TYPE.

Sample usages:

 
  static void setAtomEntryContent(
      HttpRequest request, XmlNamespaceDictionary namespaceDictionary, Object entry) {
    request.setContent(AtomContent.forEntry(namespaceDictionary, entry));
  }

  static void setAtomBatchContent(
      HttpRequest request, XmlNamespaceDictionary namespaceDictionary, Object batchFeed) {
    request.setContent(AtomContent.forFeed(namespaceDictionary, batchFeed));
  }
 
 

Implementation is not thread-safe.

Since:
1.4
Author:
Yaniv Inbar

Constructor Summary
protected AtomContent(XmlNamespaceDictionary namespaceDictionary, Object entry, boolean isEntry)
           
 
Method Summary
static AtomContent forEntry(XmlNamespaceDictionary namespaceDictionary, Object entry)
          Returns a new instance of HTTP content for an Atom entry.
static AtomContent forFeed(XmlNamespaceDictionary namespaceDictionary, Object feed)
          Returns a new instance of HTTP content for an Atom feed.
 Object getData()
          Returns the key name/value pair data for the Atom entry or Atom feed.
 boolean isEntry()
          Returns true for an Atom entry or false for an Atom feed.
 AtomContent setType(String type)
          Sets the content type or null for none.
 void writeTo(org.xmlpull.v1.XmlSerializer serializer)
          Writes the content to the given XML serializer.
 
Methods inherited from class com.google.api.client.http.xml.AbstractXmlHttpContent
getNamespaceDictionary, getType, writeTo
 
Methods inherited from class com.google.api.client.http.AbstractHttpContent
computeLength, getEncoding, getLength, retrySupported
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AtomContent

protected AtomContent(XmlNamespaceDictionary namespaceDictionary,
                      Object entry,
                      boolean isEntry)
Parameters:
namespaceDictionary - XML namespace dictionary
entry - key/value pair data for the Atom entry
isEntry - true for an Atom entry or false for an Atom feed
Since:
1.5
Method Detail

forEntry

public static AtomContent forEntry(XmlNamespaceDictionary namespaceDictionary,
                                   Object entry)
Returns a new instance of HTTP content for an Atom entry.

Parameters:
namespaceDictionary - XML namespace dictionary
entry - data key/value pair for the Atom entry
Since:
1.5

forFeed

public static AtomContent forFeed(XmlNamespaceDictionary namespaceDictionary,
                                  Object feed)
Returns a new instance of HTTP content for an Atom feed.

Parameters:
namespaceDictionary - XML namespace dictionary
feed - data key/value pair for the Atom feed
Since:
1.5

setType

public AtomContent setType(String type)
Description copied from class: AbstractXmlHttpContent
Sets the content type or null for none.

Defaults to XmlHttpParser.CONTENT_TYPE, though subclasses may define a different default value.

Overrides:
setType in class AbstractXmlHttpContent

writeTo

public final void writeTo(org.xmlpull.v1.XmlSerializer serializer)
                   throws IOException
Description copied from class: AbstractXmlHttpContent
Writes the content to the given XML serializer.

Specified by:
writeTo in class AbstractXmlHttpContent
Throws:
IOException - I/O exception

isEntry

public final boolean isEntry()
Returns true for an Atom entry or false for an Atom feed.

Since:
1.5

getData

public final Object getData()
Returns the key name/value pair data for the Atom entry or Atom feed.

Since:
1.5


Copyright © 2011-2012 Google. All Rights Reserved.