public class

Collection

extends Element
implements Reference ICollection
java.lang.Object
   ↳ com.google.gdata.model.Element
     ↳ com.google.gdata.model.atompub.Collection

Class Overview

The Collection class defines the basic Java object model representation and XML parsing/generation support for an APP collection.

The implementation is versioned to support the AtomPub draft version 9 introspection format (used for the GData v1 implementation) as well as the final RFC5023 format (used for all other versions). The key difference between the two is that draft used an attribute for the collection title and a comma-delimited list for accepted MIME types, where the final version uses atom:title and repeating app:accept elements.

Summary

Fields
public static final AttributeKey<String> HREF The href attribute.
public static final ElementKey<Void, Collection> KEY The key for this element.
public static final AttributeKey<String> TITLE Qualified name of title attribute.
private final Version coreVersion
[Expand]
Inherited Fields
From class com.google.gdata.model.Element
Public Constructors
Collection()
Default mutable constructor.
Collection(String href)
Construct a collection with the given href.
Collection(String href, TextContent title, String... accepts)
Construct a collection with all fields.
Protected Constructors
Collection(ElementKey<?, ? extends Collection> key)
Lets subclasses create an instance using a custom key.
Collection(ElementKey<?, ? extends Collection> key, Element source)
Constructs a new instance by doing a shallow copy of data from an existing Element instance.
Public Methods
Collection addAccept(Accept accept)
Adds a new accept element.
Collection addAccept(String accept)
Adds a new accept string.
Collection addCategories(Categories categories)
Adds a new app categories document.
List<String> getAcceptList()
Returns a list of accept strings.
List<Accept> getAccepts()
Returns the accept elements.
List<Categories> getCategorieses()
Returns the app categories documents.
String getHref()
Returns the href.
TextContent getTitle()
Returns the title.
boolean hasAccepts()
Returns whether it has the accept elements.
boolean hasCategorieses()
Returns whether it has the app categories documents.
boolean hasHref()
Returns whether it has the href.
boolean hasTitle()
Returns whether it has the title.
static void registerMetadata(MetadataRegistry registry)
Registers the metadata for this element.
boolean removeAccept(Accept accept)
Removes an accept element.
boolean removeAccept(String acceptStr)
Removes an accept string.
Element resolve(ElementMetadata<?, ?> metadata, ValidationContext vc)
Resolve this element's state against the metadata.
void setHref(String href)
Sets the href.
Collection setTitle(TextContent title)
Sets the title.
String toString()
[Expand]
Inherited Methods
From class com.google.gdata.model.Element
From class java.lang.Object
From interface com.google.gdata.data.Reference
From interface com.google.gdata.data.introspection.ICollection

Fields

public static final AttributeKey<String> HREF

The href attribute.

public static final ElementKey<Void, Collection> KEY

The key for this element.

public static final AttributeKey<String> TITLE

Qualified name of title attribute.

private final Version coreVersion

Public Constructors

public Collection ()

Default mutable constructor.

public Collection (String href)

Construct a collection with the given href.

Parameters
href Href.

public Collection (String href, TextContent title, String... accepts)

Construct a collection with all fields.

Parameters
href
title
accepts

Protected Constructors

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

Lets subclasses create an instance using a custom key.

Parameters
key

protected Collection (ElementKey<?, ? extends Collection> key, Element source)

Constructs a new instance by doing a shallow copy of data from an existing Element instance. Will use the given ElementMetadata as the metadata for the element.

Parameters
key The element key to use for this element
source Source element

Public Methods

public Collection addAccept (Accept accept)

Adds a new accept element.

Parameters
accept Accept element

public Collection addAccept (String accept)

Adds a new accept string.

Parameters
accept Accept string

public Collection addCategories (Categories categories)

Adds a new app categories document.

Parameters
categories App categories document

public List<String> getAcceptList ()

Returns a list of accept strings.

public List<Accept> getAccepts ()

Returns the accept elements.

Returns
  • accept elements

public List<Categories> getCategorieses ()

Returns the app categories documents.

Returns
  • app categories documents

public String getHref ()

Returns the href.

Returns
  • href

public TextContent getTitle ()

Returns the title.

Returns
  • title

public boolean hasAccepts ()

Returns whether it has the accept elements.

Returns
  • whether it has the accept elements

public boolean hasCategorieses ()

Returns whether it has the app categories documents.

Returns
  • whether it has the app categories documents

public boolean hasHref ()

Returns whether it has the href.

Returns
  • whether it has the href

public boolean hasTitle ()

Returns whether it has the title.

Returns
  • whether it has the title

public static void registerMetadata (MetadataRegistry registry)

Registers the metadata for this element.

Parameters
registry

public boolean removeAccept (Accept accept)

Removes an accept element.

Parameters
accept Accept element
Returns
  • true if the accept was removed

public boolean removeAccept (String acceptStr)

Removes an accept string.

Parameters
acceptStr The string to remove
Returns
  • true if the acceptStr was removed.

public Element resolve (ElementMetadata<?, ?> metadata, ValidationContext vc)

Resolve this element's state against the metadata. Accumulates errors in caller's validation context.

Parameters
metadata
vc Validation context
Returns
  • the narrowed element if narrowing took place.

public void setHref (String href)

Sets the href.

Parameters
href Href or null to reset

public Collection setTitle (TextContent title)

Sets the title.

Parameters
title Title or null to reset

public String toString ()