public class

Category

extends Element
implements ICategory
java.lang.Object
   ↳ com.google.gdata.model.Element
     ↳ com.google.gdata.model.atom.Category

Class Overview

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

Summary

Fields
public static final ElementKey<Void, Category> KEY The key for this element.
public static final AttributeKey<String> LABEL The category label attribute.
public static final AttributeKey<String> SCHEME The category scheme attribute.
public static final AttributeKey<String> TERM The category term attribute.
public static final AttributeKey<String> XML_LANG Qualified name for the XML lang attribute
private static final Pattern categoryPattern
[Expand]
Inherited Fields
From class com.google.gdata.model.Element
Public Constructors
Category()
Constructs a new category instance using the default metadata.
Category(String category)
Constructs a new category from a Category string.
Category(String scheme, String term)
Constructs a new category with the specified scheme and term values.
Category(String scheme, String term, String label)
Constructs a new category with the specified scheme, term, and label values.
Protected Constructors
Category(ElementKey<?, ? extends Category> key)
Constructs a new category instance using the specified element key.
Category(ElementKey<?, ? extends Category> key, Element source)
Constructs a new instance by doing a shallow copy of data from an existing Element instance.
Public Methods
boolean equals(Object obj)
String getLabel()
Returns the category label or null if there is no label value.
String getLabelLang()
Returns the language associated with the category label (or null if undefined).
String getScheme()
Returns the category scheme or null if the category does not have a scheme.
String getTerm()
Returns the category term.
int hashCode()
Category lock()
Locks this element.
static void registerMetadata(MetadataRegistry registry)
Registers the metadata for this element.
void setLabel(String label)
Sets the category label.
void setLabelLang(String lang)
Sets the language associated with the category label (or nulll if undefined).
void setScheme(String scheme)
Sets the category scheme.
void setTerm(String term)
Sets the category term value.
String toString()
Protected Methods
Element narrow(ElementMetadata<?, ?> meta, ValidationContext vc)
Narrow down element's type to the most specific one possible.
[Expand]
Inherited Methods
From class com.google.gdata.model.Element
From class java.lang.Object
From interface com.google.gdata.data.ICategory

Fields

public static final ElementKey<Void, Category> KEY

The key for this element.

public static final AttributeKey<String> LABEL

The category label attribute.

public static final AttributeKey<String> SCHEME

The category scheme attribute.

public static final AttributeKey<String> TERM

The category term attribute.

public static final AttributeKey<String> XML_LANG

Qualified name for the XML lang attribute

private static final Pattern categoryPattern

Public Constructors

public Category ()

Constructs a new category instance using the default metadata.

public Category (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

public Category (String scheme, String term)

Constructs a new category with the specified scheme and term values.

Parameters
scheme
term

public Category (String scheme, String term, String label)

Constructs a new category with the specified scheme, term, and label values.

Parameters
scheme
term
label

Protected Constructors

protected Category (ElementKey<?, ? extends Category> key)

Constructs a new category instance using the specified element key.

Parameters
key The element key for the 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

Public Methods

public boolean equals (Object obj)

Parameters
obj

public String getLabel ()

Returns the category label or null if there is no label value.

Returns
  • category label (or @code null}.

public String getLabelLang ()

Returns the language associated with the category label (or null if undefined).

public String getScheme ()

Returns the category scheme or null if the category does not have a scheme.

Returns
  • category scheme or null.

public String getTerm ()

Returns the category term.

Returns
  • category term value.

public int hashCode ()

public Category lock ()

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.

public static void registerMetadata (MetadataRegistry registry)

Registers the metadata for this element.

Parameters
registry

public void setLabel (String label)

Sets the category label. A value of null indicates that there is no label.

Parameters
label Category label value.

public void setLabelLang (String lang)

Sets the language associated with the category label (or nulll if undefined).

Parameters
lang Label language.

public void setScheme (String scheme)

Sets the category scheme. A value of null indicates that there is no category scheme.

Parameters
scheme Category scheme URI.

public void setTerm (String term)

Sets the category term value.

Parameters
term

public String toString ()

Protected Methods

protected Element narrow (ElementMetadata<?, ?> meta, ValidationContext vc)

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.

Parameters
meta The element metadata to narrow to.
vc Validation context
Returns
  • element narrowed down to the most specific type