class SyndCategoryListFacade extends java.util.AbstractList<SyndCategory>
It acts as a facade on top of the DCSubjectImpl elements of the underlying list and remains in synch with it. It is possible to work on either list, the categories one or the subjects one and they remain in synch.
This is necessary because the SyndFeedImpl categories are just a convenience to access the DublinCore subjects.
All this mess to avoid making DCSubjectImpl implement SyndCategory (which it would be odd).
Modifier and Type | Field and Description |
---|---|
private java.util.List<DCSubject> |
subjects |
Constructor and Description |
---|
SyndCategoryListFacade()
Default constructor.
|
SyndCategoryListFacade(java.util.List<DCSubject> subjects)
Creates a facade list of categories on top the given subject list.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
SyndCategory obj)
Adds a category to the list.
|
static java.util.List<DCSubject> |
convertElementsSyndCategoryToSubject(java.util.List<SyndCategory> cList)
Returns a list with the DCSubject elements of the SyndCategoryImpl list facade.
|
SyndCategory |
get(int index)
Gets the category by index.
|
SyndCategory |
remove(int index)
Removes a category element from a specific position.
|
SyndCategory |
set(int index,
SyndCategory obj)
Sets a category in an existing position in the list.
|
int |
size()
Returns the size of the list.
|
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
private final java.util.List<DCSubject> subjects
public SyndCategoryListFacade()
public SyndCategoryListFacade(java.util.List<DCSubject> subjects)
subjects
- the list of subjects to create the facade.public SyndCategory get(int index)
get
in interface java.util.List<SyndCategory>
get
in class java.util.AbstractList<SyndCategory>
index
- the index position to retrieve the category.public int size()
size
in interface java.util.Collection<SyndCategory>
size
in interface java.util.List<SyndCategory>
size
in class java.util.AbstractCollection<SyndCategory>
public SyndCategory set(int index, SyndCategory obj)
set
in interface java.util.List<SyndCategory>
set
in class java.util.AbstractList<SyndCategory>
index
- position to set the category.obj
- the SyndCategoryImpl object to set.public void add(int index, SyndCategory obj)
add
in interface java.util.List<SyndCategory>
add
in class java.util.AbstractList<SyndCategory>
index
- position to add the category.obj
- the SyndCategoryImpl object to add.public SyndCategory remove(int index)
remove
in interface java.util.List<SyndCategory>
remove
in class java.util.AbstractList<SyndCategory>
index
- position to remove the category from.public static java.util.List<DCSubject> convertElementsSyndCategoryToSubject(java.util.List<SyndCategory> cList)
cList
- the list with SyndCategoryImpl elements to convert to subject list.