Package cz.martlin.xspf.playlist.base
Class XSPFCollection<E extends XSPFElement>
- java.lang.Object
-
- cz.martlin.xspf.playlist.base.XSPFNode
-
- cz.martlin.xspf.playlist.base.XSPFElement
-
- cz.martlin.xspf.playlist.base.XSPFCollection<E>
-
- Type Parameters:
E-
- Direct Known Subclasses:
XSPFExtensions,XSPFLinks,XSPFMetas,XSPFTracks
public abstract class XSPFCollection<E extends XSPFElement> extends XSPFElement
An abstract collection of siblingXSPFElements of the same type (element name, type). Features: create brand new element, add element, remove element, list all elements.- Author:
- martin
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class cz.martlin.xspf.playlist.base.XSPFElement
XSPFElement.XSPFCollectionFactory<E extends XSPFElement>
-
-
Constructor Summary
Constructors Constructor Description XSPFCollection(Element container)Creates instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidadd(E element)Adds the given element to this collection.protected abstract Ecreate(Element child)Creates theXSPFElementfor the given XML element.EcreateNew()Creates (but does not add to this collection yet) new element.protected abstract StringelemName()Returns the element name of the children.booleanequals(Object obj)inthashCode()Iterable<E>iterate()Returns iterable version of this collection.java.util.stream.Stream<E>list()Returns theStreamcontaining all the elements inside of this collection.voidremove(E element)Removes the given element from this collection.intsize()Returns the count of elements in this collection.StringtoString()-
Methods inherited from class cz.martlin.xspf.playlist.base.XSPFElement
collection, collection, getCollection, getCollection, getDate, getDuration, getElement, getInt, getNode, getStr, getStr, getUri, getUri, getUriAttr, setCollection, setCollection, setDate, setDuration, setInt, setStr, setStr, setUri, setUri, setUriAttr
-
-
-
-
Constructor Detail
-
XSPFCollection
public XSPFCollection(Element container)
Creates instance.- Parameters:
container- The common parent element of all the elements inside of this collection.
-
-
Method Detail
-
createNew
public E createNew() throws XSPFException
Creates (but does not add to this collection yet) new element.- Returns:
- Throws:
XSPFException
-
create
protected abstract E create(Element child)
Creates theXSPFElementfor the given XML element.- Parameters:
child-- Returns:
-
elemName
protected abstract String elemName()
Returns the element name of the children.- Returns:
-
add
public void add(E element) throws XSPFException
Adds the given element to this collection.- Parameters:
element-- Throws:
XSPFException
-
remove
public void remove(E element) throws XSPFException
Removes the given element from this collection.- Parameters:
element-- Throws:
XSPFException
-
iterate
public Iterable<E> iterate() throws XSPFException
Returns iterable version of this collection.- Returns:
- Throws:
XSPFException
-
list
public java.util.stream.Stream<E> list() throws XSPFException
Returns theStreamcontaining all the elements inside of this collection.- Returns:
- Throws:
XSPFException
-
size
public int size() throws XSPFExceptionReturns the count of elements in this collection.- Returns:
- Throws:
XSPFException
-
-