FileDocCategorySizeDatePackage
XmlContactsGDataParserFactory.javaAPI DocAndroid 1.5 API4480Wed May 06 22:41:16 BST 2009com.google.wireless.gdata.contacts.parser.xml

XmlContactsGDataParserFactory

public class XmlContactsGDataParserFactory extends Object implements com.google.wireless.gdata.client.GDataParserFactory
GDataParserFactory that creates XML GDataParsers and GDataSerializers for Google Contacts.

Fields Summary
private final com.google.wireless.gdata.parser.xml.XmlParserFactory
xmlFactory
Constructors Summary
public XmlContactsGDataParserFactory(com.google.wireless.gdata.parser.xml.XmlParserFactory xmlFactory)

    this.xmlFactory = xmlFactory;
  
Methods Summary
public com.google.wireless.gdata.parser.GDataParsercreateGroupEntryFeedParser(java.io.InputStream is)
Returns a parser for a contacts group feed.

param
is The input stream to be parsed.
return
A parser for the stream.
throws
com.google.wireless.gdata.parser.ParseException

      XmlPullParser xmlParser;
      try {
        xmlParser = xmlFactory.createParser();
      } catch (XmlPullParserException xppe) {
        throw new ParseException("Could not create XmlPullParser", xppe);
      }
      return new XmlGroupEntryGDataParser(is, xmlParser);
    
public com.google.wireless.gdata.parser.GDataParsercreateMediaEntryFeedParser(java.io.InputStream is)
Returns a parser for a media entry feed.

param
is The input stream to be parsed.
return
A parser for the stream.
throws
ParseException

    XmlPullParser xmlParser;
    try {
      xmlParser = xmlFactory.createParser();
    } catch (XmlPullParserException xppe) {
      throw new ParseException("Could not create XmlPullParser", xppe);
    }
    return new XmlMediaEntryGDataParser(is, xmlParser);
  
public com.google.wireless.gdata.parser.GDataParsercreateParser(java.io.InputStream is)

    XmlPullParser xmlParser;
    try {
      xmlParser = xmlFactory.createParser();
    } catch (XmlPullParserException xppe) {
      throw new ParseException("Could not create XmlPullParser", xppe);
    }
    return new XmlContactsGDataParser(is, xmlParser);
  
public com.google.wireless.gdata.parser.GDataParsercreateParser(java.lang.Class entryClass, java.io.InputStream is)

    if (entryClass == ContactEntry.class) {
      return createParser(is);
    }
    if (entryClass == GroupEntry.class) {
      return createGroupEntryFeedParser(is);
    }
    if (entryClass == MediaEntry.class) {
      return createMediaEntryFeedParser(is);
    }
    throw new IllegalArgumentException("unexpected feed type, " + entryClass.getName());
  
public com.google.wireless.gdata.serializer.GDataSerializercreateSerializer(com.google.wireless.gdata.data.Entry entry)
Creates a new {@link GDataSerializer} for the provided entry. The entry must be an instance of {@link ContactEntry} or {@link GroupEntry}.

param
entry The {@link ContactEntry} that should be serialized.
return
The {@link GDataSerializer} that will serialize this entry.
throws
IllegalArgumentException Thrown if entry is not a {@link ContactEntry} or {@link GroupEntry}.
see
com.google.wireless.gdata.client.GDataParserFactory#createSerializer

    if (entry instanceof ContactEntry) {
      ContactEntry contactEntry = (ContactEntry) entry;
      return new XmlContactEntryGDataSerializer(xmlFactory, contactEntry);
    }
    if (entry instanceof GroupEntry) {
      GroupEntry groupEntry = (GroupEntry) entry;
      return new XmlGroupEntryGDataSerializer(xmlFactory, groupEntry);
    }
    throw new IllegalArgumentException("unexpected entry type, " + entry.getClass().toString());