Package cz.martlin.xspf.playlist.base
Class XSPFElement
- java.lang.Object
-
- cz.martlin.xspf.playlist.base.XSPFNode
-
- cz.martlin.xspf.playlist.base.XSPFElement
-
- Direct Known Subclasses:
XSPFAttribution,XSPFCollection,XSPFCommon,XSPFExtension,XSPFLink,XSPFLink,XSPFMeta
public abstract class XSPFElement extends XSPFNode
The base element in the xspf-playlist implementation. Encapsulates some XML element and provides some helpfull methods, like to list children or set attribute value.- Author:
- martin
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceXSPFElement.XSPFCollectionFactory<E extends XSPFElement>The mapping of element toXSPFCollectioninstance.
-
Constructor Summary
Constructors Constructor Description XSPFElement(Element element)Creates instance for the given element.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <E extends XSPFElement>
XSPFCollection<E>collection(XSPFElement.XSPFCollectionFactory<E> factory)Returns the collection (view) mapped to this element, constructed by the given factory.protected <E extends XSPFElement>
XSPFCollection<E>collection(String name, XSPFElement.XSPFCollectionFactory<E> factory)Returns the collection (view) mapped to this element's child of given name, constructed by the given factory.protected <E extends XSPFElement>
XSPFCollection<E>getCollection(XSPFElement.XSPFCollectionFactory<E> factory)Returns the collection (clone) mapped to this element, constructed by the given factory.protected <E extends XSPFElement>
XSPFCollection<E>getCollection(String name, XSPFElement.XSPFCollectionFactory<E> factory)Returns the collection (clone) mapped to this element's child of given name, constructed by the given factory.protected java.time.LocalDateTimegetDate(String name)Gets datetime contents of this element's child of given name.protected java.time.DurationgetDuration(String name)Gets duration contents of this element's child of given name.protected ElementgetElement()Returns the element.protected IntegergetInt(String name)Gets integer contents of this element's child of given name.NodegetNode()protected StringgetStr()Returns actual element's string contents.protected StringgetStr(String name)Get string contents of this element's child of given name.protected URIgetUri()Gets uri contents of this element.protected URIgetUri(String name)Gets uri contents of this element's child of given name.protected URIgetUriAttr(String name)Gets uri contents of this element's attribute of given name.protected <E extends XSPFElement,C extends XSPFCollection<E>>
voidsetCollection(XSPFCollection<E> collection)Sets the collection (clone) mapped to this element.protected <E extends XSPFElement,C extends XSPFCollection<E>>
voidsetCollection(String name, XSPFCollection<E> collection)Sets the collection (clone) mapped to this element's child of given name.protected voidsetDate(String name, java.time.LocalDateTime value)Sets datetime contents of this element's child of given name.protected voidsetDuration(String name, java.time.Duration value)Sets duration contents of this element's child of given name.protected voidsetInt(String name, int value)Set integer contents of this element's child of given name.protected voidsetStr(String value)Sets actual element's string contents.protected voidsetStr(String name, String value)Sets string contents of this element's child of given name.protected voidsetUri(String name, URI value)Sets uri contents of this element's child of given name.protected voidsetUri(URI value)Sets uri contents of this element.protected voidsetUriAttr(String name, URI value)Sets uri contents of this element's attribute of given name.
-
-
-
Constructor Detail
-
XSPFElement
public XSPFElement(Element element)
Creates instance for the given element.- Parameters:
element-
-
-
Method Detail
-
getElement
protected Element getElement()
Returns the element.- Returns:
-
getStr
protected String getStr() throws XSPFException
Returns actual element's string contents.- Returns:
- Throws:
XSPFException
-
getStr
protected String getStr(String name) throws XSPFException
Get string contents of this element's child of given name.- Parameters:
name-- Returns:
- Throws:
XSPFException
-
setStr
protected void setStr(String value) throws XSPFException
Sets actual element's string contents.- Parameters:
value-- Throws:
XSPFException
-
setStr
protected void setStr(String name, String value) throws XSPFException
Sets string contents of this element's child of given name.- Parameters:
name-value-- Throws:
XSPFException
-
getUri
protected URI getUri(String name) throws XSPFException
Gets uri contents of this element's child of given name.- Parameters:
name-- Returns:
- Throws:
XSPFException
-
setUri
protected void setUri(String name, URI value) throws XSPFException
Sets uri contents of this element's child of given name.- Parameters:
name-value-- Throws:
XSPFException
-
getUriAttr
protected URI getUriAttr(String name) throws XSPFException
Gets uri contents of this element's attribute of given name.- Parameters:
name-- Returns:
- Throws:
XSPFException
-
setUriAttr
protected void setUriAttr(String name, URI value) throws XSPFException
Sets uri contents of this element's attribute of given name.- Parameters:
name-value-- Throws:
XSPFException
-
getDate
protected java.time.LocalDateTime getDate(String name) throws XSPFException
Gets datetime contents of this element's child of given name.- Parameters:
name-- Returns:
- Throws:
XSPFException
-
setDate
protected void setDate(String name, java.time.LocalDateTime value) throws XSPFException
Sets datetime contents of this element's child of given name.- Parameters:
name-value-- Throws:
XSPFException
-
getDuration
protected java.time.Duration getDuration(String name) throws XSPFException
Gets duration contents of this element's child of given name.- Parameters:
name-- Returns:
- Throws:
XSPFException
-
setDuration
protected void setDuration(String name, java.time.Duration value) throws XSPFException
Sets duration contents of this element's child of given name.- Parameters:
name-value-- Throws:
XSPFException
-
getInt
protected Integer getInt(String name) throws XSPFException
Gets integer contents of this element's child of given name.- Parameters:
name-- Returns:
- Throws:
XSPFException
-
setInt
protected void setInt(String name, int value) throws XSPFException
Set integer contents of this element's child of given name.- Parameters:
name-value-- Throws:
XSPFException
-
getUri
protected URI getUri() throws XSPFException
Gets uri contents of this element.- Returns:
- Throws:
XSPFException
-
setUri
protected void setUri(URI value) throws XSPFException
Sets uri contents of this element.- Parameters:
value-- Throws:
XSPFException
-
getCollection
protected <E extends XSPFElement> XSPFCollection<E> getCollection(XSPFElement.XSPFCollectionFactory<E> factory) throws XSPFException
Returns the collection (clone) mapped to this element, constructed by the given factory.- Type Parameters:
E-- Parameters:
factory-- Returns:
- Throws:
XSPFException
-
collection
protected <E extends XSPFElement> XSPFCollection<E> collection(XSPFElement.XSPFCollectionFactory<E> factory) throws XSPFException
Returns the collection (view) mapped to this element, constructed by the given factory.- Type Parameters:
E-- Parameters:
factory-- Returns:
- Throws:
XSPFException
-
setCollection
protected <E extends XSPFElement,C extends XSPFCollection<E>> void setCollection(XSPFCollection<E> collection) throws XSPFException
Sets the collection (clone) mapped to this element.- Type Parameters:
E-C-- Parameters:
collection-- Throws:
XSPFException
-
getCollection
protected <E extends XSPFElement> XSPFCollection<E> getCollection(String name, XSPFElement.XSPFCollectionFactory<E> factory) throws XSPFException
Returns the collection (clone) mapped to this element's child of given name, constructed by the given factory.- Type Parameters:
E-- Parameters:
name-factory-- Returns:
- Throws:
XSPFException
-
collection
protected <E extends XSPFElement> XSPFCollection<E> collection(String name, XSPFElement.XSPFCollectionFactory<E> factory) throws XSPFException
Returns the collection (view) mapped to this element's child of given name, constructed by the given factory.- Type Parameters:
E-- Parameters:
name-factory-- Returns:
- Throws:
XSPFException
-
setCollection
protected <E extends XSPFElement,C extends XSPFCollection<E>> void setCollection(String name, XSPFCollection<E> collection) throws XSPFException
Sets the collection (clone) mapped to this element's child of given name.- Type Parameters:
E-C-- Parameters:
name-collection-- Throws:
XSPFException
-
-