com.google.gdata.model.atom
Class Category

java.lang.Object
  extended by com.google.gdata.model.Element
      extended by com.google.gdata.model.atom.Category
All Implemented Interfaces:
ICategory

public class Category
extends Element
implements ICategory

The Category class represents the data model for the Atom category element.


Field Summary
static ElementKey<java.lang.Void,Category> KEY
          The key for this element.
static AttributeKey<java.lang.String> LABEL
          The category label attribute.
static AttributeKey<java.lang.String> SCHEME
          The category scheme attribute.
static AttributeKey<java.lang.String> TERM
          The category term attribute.
static AttributeKey<java.lang.String> XML_LANG
          Qualified name for the XML lang attribute
 
Constructor Summary
  Category()
          Constructs a new category instance using the default metadata.
protected Category(ElementKey<?,? extends Category> key)
          Constructs a new category instance using the specified element key.
protected Category(ElementKey<?,? extends Category> key, Element source)
          Constructs a new instance by doing a shallow copy of data from an existing Element instance.
  Category(java.lang.String category)
          Constructs a new category from a Category string.
  Category(java.lang.String scheme, java.lang.String term)
          Constructs a new category with the specified scheme and term values.
  Category(java.lang.String scheme, java.lang.String term, java.lang.String label)
          Constructs a new category with the specified scheme, term, and label values.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.String getLabel()
          Returns the category label or null if there is no label value.
 java.lang.String getLabelLang()
          Returns the language associated with the category label (or null if undefined).
 java.lang.String getScheme()
          Returns the category scheme or null if the category does not have a scheme.
 java.lang.String getTerm()
          Returns the category term.
 int hashCode()
           
 Category lock()
          Locks this element.
protected  Element narrow(ElementMetadata<?,?> meta, ValidationContext vc)
          Narrow down element's type to the most specific one possible.
static void registerMetadata(MetadataRegistry registry)
          Registers the metadata for this element.
 void setLabel(java.lang.String label)
          Sets the category label.
 void setLabelLang(java.lang.String lang)
          Sets the language associated with the category label (or nulll if undefined).
 void setScheme(java.lang.String scheme)
          Sets the category scheme.
 void setTerm(java.lang.String term)
          Sets the category term value.
 java.lang.String toString()
           
 
Methods inherited from class com.google.gdata.model.Element
adapt, adapt, addElement, addElement, addElement, clear, createElement, createElement, eq, getAttributeCount, getAttributeIterator, getAttributeIterator, getAttributeValue, getAttributeValue, getDefaultKey, getElement, getElement, getElementCount, getElementId, getElementIterator, getElementIterator, getElementKey, getElements, getElements, getElementSet, getElementSet, getElementValue, getElementValue, getTextValue, getTextValue, hasAttribute, hasAttribute, hasElement, hasElement, hasTextValue, isLocked, removeAttribute, removeAttribute, removeAttributeValue, removeAttributeValue, removeElement, removeElement, removeElement, removeElement, replaceElement, resolve, resolve, sameClassAs, setAttributeValue, setAttributeValue, setElement, setElement, setElement, setTextValue, validate, visit
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

KEY

public static final ElementKey<java.lang.Void,Category> KEY
The key for this element.


SCHEME

public static final AttributeKey<java.lang.String> SCHEME
The category scheme attribute.


TERM

public static final AttributeKey<java.lang.String> TERM
The category term attribute.


LABEL

public static final AttributeKey<java.lang.String> LABEL
The category label attribute.


XML_LANG

public static final AttributeKey<java.lang.String> XML_LANG
Qualified name for the XML lang attribute

Constructor Detail

Category

public Category()
Constructs a new category instance using the default metadata.


Category

protected Category(ElementKey<?,? extends Category> key)
Constructs a new category instance using the specified element key.

Parameters:
key - the element key for the category.

Category

protected Category(ElementKey<?,? extends Category> key,
                   Element source)
Constructs a new instance by doing a shallow copy of data from an existing Element instance. Will use the given ElementKey as the key for the element.

Parameters:
key - the element key to use for the category
source - source element

Category

public Category(java.lang.String category)
Constructs a new category from a Category string. The format of the String is the same as the one used to represent a category in a GData query: an optional scheme surrounded by braces, followed by a term.

Parameters:
category - the category string

Category

public Category(java.lang.String scheme,
                java.lang.String term)
Constructs a new category with the specified scheme and term values.


Category

public Category(java.lang.String scheme,
                java.lang.String term,
                java.lang.String label)
Constructs a new category with the specified scheme, term, and label values.

Method Detail

registerMetadata

public static void registerMetadata(MetadataRegistry registry)
Registers the metadata for this element.


lock

public Category lock()
Description copied from class: Element
Locks this element. A locked element cannot have any changes made to its content or its attributes or child elements. This will also lock all attributes and child elements as well. Once this method has been called, this element can be safely published to other threads.

Overrides:
lock in class Element

getScheme

public java.lang.String getScheme()
Returns the category scheme or null if the category does not have a scheme.

Specified by:
getScheme in interface ICategory
Returns:
category scheme or null.

setScheme

public void setScheme(java.lang.String scheme)
Sets the category scheme. A value of null indicates that there is no category scheme.

Parameters:
scheme - category scheme URI.

getTerm

public java.lang.String getTerm()
Returns the category term.

Specified by:
getTerm in interface ICategory
Returns:
category term value.

setTerm

public void setTerm(java.lang.String term)
Sets the category term value.

Parameters:
term -

getLabel

public java.lang.String getLabel()
Returns the category label or null if there is no label value.

Specified by:
getLabel in interface ICategory
Returns:
category label (or @code null}.

setLabel

public void setLabel(java.lang.String label)
Sets the category label. A value of null indicates that there is no label.

Parameters:
label - category label value.

getLabelLang

public java.lang.String getLabelLang()
Returns the language associated with the category label (or null if undefined).


setLabelLang

public void setLabelLang(java.lang.String lang)
Sets the language associated with the category label (or nulll if undefined).

Parameters:
lang - label language.

narrow

protected Element narrow(ElementMetadata<?,?> meta,
                         ValidationContext vc)
Description copied from class: Element
Narrow down element's type to the most specific one possible.

Any validation errors discovered during narrowing are accumulated in the validation context.

Default action is to not do anything with current element. Subclasses may override this function to narrow the type in some custom fashion.

Overrides:
narrow in class Element
Parameters:
meta - the element metadata to narrow to.
vc - validation context
Returns:
element narrowed down to the most specific type

toString

public java.lang.String toString()
Overrides:
toString in class Element

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class Element

hashCode

public int hashCode()
Overrides:
hashCode in class Element