public class

Categories

extends ExtensionPoint
java.lang.Object
   ↳ com.google.gdata.data.AbstractExtension
     ↳ com.google.gdata.data.ExtensionPoint
       ↳ com.google.gdata.data.introspection.Categories

Class Overview

The Categories class implements the data model for the AtomPub categories element, as described in Sec 7.2.1 of the AtomPub specification.

Summary

Nested Classes
class Categories.Handler The Handler class implements the XmlParser.ElementHandler for parsing an app:categories element. 
Fields
private XmlNamespace atomPubNs
private List<Category> categories
private String defaultScheme
private Boolean fixed
private String href
[Expand]
Inherited Fields
From class com.google.gdata.data.ExtensionPoint
From class com.google.gdata.data.AbstractExtension
Public Constructors
Categories()
Constructs a new empty Categories instance for the purposes of parsing an AtomPub categories element or document.
Categories(boolean fixed, String defaultScheme, Category... categories)
Constructs a Categories instance with in-line category descriptions.
Categories(String href)
Constructs a Categories instance that references an out-of-line list of categories stored in a category document.
Public Methods
void addCategory(Category category)
Adds a new category to the category list.
void generate(XmlWriter w, ExtensionProfile extProfile)
Generates XML.
List<Category> getCategoryList()
Returns the list of in-line categories or null if there is no associated list.
String getDefaultScheme()
Returns the default scheme used for nested categories if not specified directly on the instance.
XmlParser.ElementHandler getHandler(ExtensionProfile p, String namespace, String localName, Attributes attrs)
The default implementation uses the AbstractExtension.AttributesHandler to handle parsing the extension.
String getHref()
Returns the location of an external AtomPub categories document that describes the list of categories.
boolean isFixed()
Returns true if the Categories instance contains in-line category data that is a fixed set.
void parseAtom(ExtensionProfile extProfile, XmlParser parser)
Parses a Categories element using data read from the specified parser instance.
void validate()
Checks the attributes to see if there are any problems.
Protected Methods
void consumeAttributes(AttributeHelper helper)
Consumes attributes from the attribute helper.
[Expand]
Inherited Methods
From class com.google.gdata.data.ExtensionPoint
From class com.google.gdata.data.AbstractExtension
From class java.lang.Object
From interface com.google.gdata.data.Extension

Fields

private XmlNamespace atomPubNs

private List<Category> categories

private String defaultScheme

private Boolean fixed

private String href

Public Constructors

public Categories ()

Constructs a new empty Categories instance for the purposes of parsing an AtomPub categories element or document.

public Categories (boolean fixed, String defaultScheme, Category... categories)

Constructs a Categories instance with in-line category descriptions.

Parameters
fixed true if the list of categories is a fixed set, false if an open set.
defaultScheme The default scheme uri value that will be used for all nested category elements that do not have a scheme.
categories List of categories.

public Categories (String href)

Constructs a Categories instance that references an out-of-line list of categories stored in a category document.

Parameters
href

Public Methods

public void addCategory (Category category)

Adds a new category to the category list.

Parameters
category New category to add.

public void generate (XmlWriter w, ExtensionProfile extProfile)

Generates XML.

Parameters
w Output writer
extProfile Extension profile
Throws
IOException

public List<Category> getCategoryList ()

Returns the list of in-line categories or null if there is no associated list.

Returns
  • category list or null.

public String getDefaultScheme ()

Returns the default scheme used for nested categories if not specified directly on the instance. May be null if there is no default scheme.

Returns
  • default scheme uri or null.

public XmlParser.ElementHandler getHandler (ExtensionProfile p, String namespace, String localName, Attributes attrs)

The default implementation uses the AbstractExtension.AttributesHandler to handle parsing the extension.

Parameters
p Extension profile
namespace Extension namespace
localName Tag name, without the namespace prefix
attrs Tag attributes
Returns
  • an element handler

public String getHref ()

Returns the location of an external AtomPub categories document that describes the list of categories.

Returns
  • uri of external Categories document or null if none.

public boolean isFixed ()

Returns true if the Categories instance contains in-line category data that is a fixed set.

Returns
  • true there is a fixed set of categories.

public void parseAtom (ExtensionProfile extProfile, XmlParser parser)

Parses a Categories element using data read from the specified parser instance.

Parameters
extProfile Extension profile.
parser XML input parse.
Throws
IOException
ParseException

public void validate ()

Checks the attributes to see if there are any problems. Default implementation does nothing, though generally this is discouraged unless there really are no restrictions.

Throws
IllegalStateException

Protected Methods

protected void consumeAttributes (AttributeHelper helper)

Consumes attributes from the attribute helper. May also use consumeContent(boolean) to consume the element's text content. Called from getHandler(ExtensionProfile, String, String, Attributes). Default implementation does nothing, though generally this is discouraged unless there really are no attributes.

Parameters
helper Attribute helper