public class Categories extends ExtensionPoint
Modifier and Type | Class and Description |
---|---|
class |
Categories.Handler
The Handler class implements the
XmlParser.ElementHandler for
parsing an app:categories element. |
ExtensionPoint.CumulativeBlobHandler, ExtensionPoint.ExtensionHandler
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
void |
addCategory(Category category)
Adds a new category to the category list.
|
void |
generate(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
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.
|
addExtension, addRepeatingExtension, declareExtensions, generateCumulativeXmlBlob, getExtension, getExtensions, getRepeatingExtension, getRepeatingExtensions, getXmlBlob, hasExtension, hasRepeatingExtension, parseCumulativeXmlBlob, removeExtension, removeExtension, removeRepeatingExtension, setExtension, setXmlBlob, visit
disableStrictValidation, enableStrictValidation, getExtensionLocalName, getExtensionNamespace, isImmutable, isStrictValidation, setImmutable
public Categories()
public Categories(boolean fixed, java.lang.String defaultScheme, Category... categories)
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.public Categories(java.lang.String href)
href
- public boolean isFixed()
true
if the Categories instance contains in-line category
data that is a fixed set.true
there is a fixed set of categories.public java.lang.String getDefaultScheme()
null
if there is no default
scheme.null
.public java.lang.String getHref()
null
if none.public java.util.List<Category> getCategoryList()
null
if there is no
associated list.null
.public void addCategory(Category category)
category
- new category to add.public XmlParser.ElementHandler getHandler(ExtensionProfile p, java.lang.String namespace, java.lang.String localName, org.xml.sax.Attributes attrs)
AbstractExtension
AttributesHandler
to handle
parsing the extension.getHandler
in interface Extension
getHandler
in class ExtensionPoint
p
- extension profilenamespace
- extension namespacelocalName
- tag name, without the namespace prefixattrs
- tag attributespublic void validate() throws java.lang.IllegalStateException
AbstractExtension
java.lang.IllegalStateException
- if any problems are found with the
attributespublic void parseAtom(ExtensionProfile extProfile, XmlParser parser) throws java.io.IOException, ParseException
extProfile
- Extension profile.parser
- XML input parse.java.io.IOException
ParseException
public void generate(XmlWriter w, ExtensionProfile extProfile) throws java.io.IOException
generate
in interface Extension
generate
in class AbstractExtension
w
- output writerextProfile
- extension profilejava.io.IOException