public class Collection extends Element implements Reference, ICollection
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.
Modifier and Type | Field and Description |
---|---|
static AttributeKey<java.lang.String> |
HREF
The href attribute.
|
static ElementKey<java.lang.Void,Collection> |
KEY
The key for this element.
|
static AttributeKey<java.lang.String> |
TITLE
Qualified name of title attribute.
|
Modifier | Constructor and Description |
---|---|
|
Collection()
Default mutable constructor.
|
protected |
Collection(ElementKey<?,? extends Collection> key)
Lets subclasses create an instance using a custom 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. |
|
Collection(java.lang.String href)
Construct a collection with the given href.
|
|
Collection(java.lang.String href,
TextContent title,
java.lang.String... accepts)
Construct a collection with all fields.
|
Modifier and Type | Method and Description |
---|---|
Collection |
addAccept(Accept accept)
Adds a new accept element.
|
Collection |
addAccept(java.lang.String accept)
Adds a new accept string.
|
Collection |
addCategories(Categories categories)
Adds a new app categories document.
|
java.util.List<java.lang.String> |
getAcceptList()
Returns a list of accept strings.
|
java.util.List<Accept> |
getAccepts()
Returns the accept elements.
|
java.util.List<Categories> |
getCategorieses()
Returns the app categories documents.
|
java.lang.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(java.lang.String acceptStr)
Removes an accept string.
|
Element |
resolve(ElementMetadata<?,?> metadata,
ValidationContext vc)
Resolve this element's state against the metadata.
|
void |
setHref(java.lang.String href)
Sets the href.
|
Collection |
setTitle(TextContent title)
Sets the title.
|
java.lang.String |
toString() |
adapt, adapt, addElement, addElement, addElement, clear, createElement, createElement, eq, equals, 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, hashCode, hasTextValue, isLocked, lock, narrow, removeAttribute, removeAttribute, removeAttributeValue, removeAttributeValue, removeElement, removeElement, removeElement, removeElement, replaceElement, resolve, sameClassAs, setAttributeValue, setAttributeValue, setElement, setElement, setElement, setTextValue, validate, visit
public static final ElementKey<java.lang.Void,Collection> KEY
public static final AttributeKey<java.lang.String> HREF
public static final AttributeKey<java.lang.String> TITLE
public Collection()
protected Collection(ElementKey<?,? extends Collection> key)
protected Collection(ElementKey<?,? extends Collection> key, Element source)
Element
instance. Will use the given ElementMetadata
as the
metadata for the element.key
- the element key to use for this elementsource
- source elementpublic Collection(java.lang.String href)
href
- href.public Collection(java.lang.String href, TextContent title, java.lang.String... accepts)
public static void registerMetadata(MetadataRegistry registry)
public java.util.List<Accept> getAccepts()
public java.util.List<java.lang.String> getAcceptList()
getAcceptList
in interface ICollection
public Collection addAccept(Accept accept)
accept
- accept elementpublic Collection addAccept(java.lang.String accept)
accept
- accept stringpublic boolean removeAccept(Accept accept)
accept
- accept elementpublic boolean removeAccept(java.lang.String acceptStr)
acceptStr
- the string to removepublic boolean hasAccepts()
public java.util.List<Categories> getCategorieses()
public Collection addCategories(Categories categories)
categories
- app categories documentpublic boolean hasCategorieses()
public java.lang.String getHref()
public void setHref(java.lang.String href)
public boolean hasHref()
public TextContent getTitle()
getTitle
in interface ICollection
public Collection setTitle(TextContent title)
title
- title or null
to resetpublic boolean hasTitle()
public Element resolve(ElementMetadata<?,?> metadata, ValidationContext vc)
Element