# Google Data APIs Client Library (1.43.0)

## com.google.gdata.data.introspection
Class Categories

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

All Implemented Interfaces:
  Extension

    public class Categories

extends ExtensionPoint

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

Nested Class Summary
`class` `Categories.Handler` The Handler class implements the `XmlParser.ElementHandler` for parsing an `app:categories` element.

Nested classes/interfaces inherited from class com.google.gdata.data.ExtensionPoint
`ExtensionPoint.CumulativeBlobHandler, ExtensionPoint.ExtensionHandler`

Nested classes/interfaces inherited from class com.google.gdata.data.AbstractExtension
`AbstractExtension.AttributesHandler`

Field Summary

Fields inherited from class com.google.gdata.data.ExtensionPoint
`xmlBlob`

Fields inherited from class com.google.gdata.data.AbstractExtension
`localName, namespace`

Constructor Summary
`Categories()` Constructs a new empty Categories instance for the purposes of parsing an AtomPub categories element or document.
`Categories(boolean fixed, java.lang.String defaultScheme, Category... categories)` Constructs a Categories instance with in-line category descriptions.
`Categories(java.lang.String href)` Constructs a Categories instance that references an out-of-line list of categories stored in a category document.

Method Summary
`void` `addCategory(Category category)` Adds a new category to the category list.
`protected void` `consumeAttributes(AttributeHelper helper)` Consumes attributes from the attribute helper.
`void` `generate(com.google.gdata.util.common.xml.XmlWriter w, ExtensionProfile extProfile)` Generates XML.
`java.util.List<Category>` `getCategoryList()` Returns the list of in-line categories or `null` if there is no associated list.
`java.lang.String` `getDefaultScheme()` Returns the default scheme used for nested categories if not specified directly on the instance.
`XmlParser.ElementHandler` `getHandler(ExtensionProfile p, java.lang.String namespace, java.lang.String localName, org.xml.sax.Attributes attrs)` The default implementation uses the `AbstractExtension.AttributesHandler` to handle parsing the extension.
`java.lang.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.

Methods inherited from class com.google.gdata.data.ExtensionPoint

`addExtension, addExtension, addRepeatingExtension, addRepeatingExtension, checkRequiredExtensions, createExtensionInstance, declareExtensions, generate, generateCumulativeXmlBlob, generateExtensions, generateStartElement, getExtension, getExtensionDescription, getExtensionHandler, getExtensions, getManifest, getRepeatingExtension, getRepeatingExtensions, getXmlBlob, hasExtension, hasRepeatingExtension, initializeArbitraryXml, parseCumulativeXmlBlob, removeExtension, removeExtension, removeRepeatingExtension, setExtension, setXmlBlob, visit, visitChild, visitChildren`

Methods inherited from class com.google.gdata.data.AbstractExtension
`disableStrictValidation, enableStrictValidation, eq, generateAttributes, getExtensionLocalName, getExtensionNamespace, isImmutable, isStrictValidation, putAttributes, sameClassAs, setImmutable, throwExceptionForMissingAttribute, throwExceptionIfImmutable`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Categories

    public Categories()

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

  See Also:
    `parseAtom(ExtensionProfile, XmlParser)`

### Categories

    public Categories(boolean fixed,
                      java.lang.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.

### Categories

    public Categories(java.lang.String href)

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

  Parameters:
    `href` -

Method Detail

### isFixed

    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.

### getDefaultScheme

    public java.lang.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`.

### getHref

    public java.lang.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.

### getCategoryList

    public java.util.List<Category> getCategoryList()

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

  Returns:
    category list or `null`.

### addCategory

    public void addCategory(Category category)

  Adds a new category to the category list.

  Parameters:
    `category` - new category to add.

### getHandler

    public XmlParser.ElementHandler getHandler(ExtensionProfile p,
                                               java.lang.String namespace,
                                               java.lang.String localName,
                                               org.xml.sax.Attributes attrs)

  Description copied from class: `AbstractExtension`
  The default implementation uses the `AbstractExtension.AttributesHandler` to handle parsing the extension.

  Specified by:
    `getHandler` in interface `Extension`
  Overrides:
    `getHandler` in class `ExtensionPoint`
  Parameters:
    `p` - extension profile
    `namespace` - extension namespace
    `localName` - tag name, without the namespace prefix
    `attrs` - tag attributes
  Returns:
    an element handler

### consumeAttributes

    protected void consumeAttributes(AttributeHelper helper)
                              throws ParseException

  Description copied from class: `AbstractExtension`
  Consumes attributes from the attribute helper. May also use `AttributeHelper.consumeContent(boolean)` to consume the element's text content. Called from `AbstractExtension.getHandler(com.google.gdata.data.ExtensionProfile, java.lang.String, java.lang.String, org.xml.sax.Attributes)`. Default implementation does nothing, though generally this is discouraged unless there really are no attributes.

  Overrides:
    `consumeAttributes` in class `AbstractExtension`
  Parameters:
    `helper` - attribute helper
  Throws:
    `ParseException` - any parsing exception

### validate

    public void validate()
                  throws java.lang.IllegalStateException

  Description copied from class: `AbstractExtension`
  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.

  Overrides:
    `validate` in class `AbstractExtension`
  Throws:
    `java.lang.IllegalStateException` - if any problems are found with the attributes

### parseAtom

    public void parseAtom(ExtensionProfile extProfile,
                          XmlParser parser)
                   throws java.io.IOException,
                          ParseException

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

  Parameters:
    `extProfile` - Extension profile.
    `parser` - XML input parse.
  Throws:
    `java.io.IOException`
    `ParseException`

### generate

    public void generate(com.google.gdata.util.common.xml.XmlWriter w,
                         ExtensionProfile extProfile)
                  throws java.io.IOException

  Generates XML.

  Specified by:
    `generate` in interface `Extension`
  Overrides:
    `generate` in class `AbstractExtension`
  Parameters:
    `w` - output writer
    `extProfile` - extension profile
  Throws:
    `java.io.IOException`