com.sun.syndication.feed.synd
Class SyndCategoryListFacade

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList
          extended by com.sun.syndication.feed.synd.SyndCategoryListFacade
All Implemented Interfaces:
java.lang.Iterable, java.util.Collection, java.util.List

 class SyndCategoryListFacade
extends java.util.AbstractList

List implementation for SyndCategoryImpl elements. To be directly used by the SyndFeedImpl and SyndEntryImpl classes only.

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).

Author:
Alejandro Abdelnur

Field Summary
private  java.util.List _subjects
           
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
SyndCategoryListFacade()
          Default constructor.
SyndCategoryListFacade(java.util.List subjects)
          Creates a facade list of categories on top the given subject list.
 
Method Summary
 void add(int index, java.lang.Object obj)
          Adds a category to the list.
static java.util.List convertElementsSyndCategoryToSubject(java.util.List cList)
          Returns a list with the DCSubject elements of the SyndCategoryImpl list facade.
 java.lang.Object get(int index)
          Gets the category by index.
 java.lang.Object remove(int index)
          Removes a category element from a specific position.
 java.lang.Object set(int index, java.lang.Object obj)
          Sets a category in an existing position in the list.
 int size()
          Returns the size of the list.
 
Methods inherited from class java.util.AbstractList
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 

Field Detail

_subjects

private java.util.List _subjects
Constructor Detail

SyndCategoryListFacade

public SyndCategoryListFacade()
Default constructor. Creates and empty list.


SyndCategoryListFacade

public SyndCategoryListFacade(java.util.List subjects)
Creates a facade list of categories on top the given subject list.

Parameters:
subjects - the list of subjects to create the facade.
Method Detail

get

public java.lang.Object get(int index)
Gets the category by index.

Specified by:
get in interface java.util.List
Specified by:
get in class java.util.AbstractList
Parameters:
index - the index position to retrieve the category.
Returns:
the SyndCategoryImpl in position index, null if none.

size

public int size()
Returns the size of the list.

Specified by:
size in interface java.util.Collection
Specified by:
size in interface java.util.List
Specified by:
size in class java.util.AbstractCollection
Returns:
the size of the list.

set

public java.lang.Object set(int index,
                            java.lang.Object obj)
Sets a category in an existing position in the list.

Specified by:
set in interface java.util.List
Overrides:
set in class java.util.AbstractList
Parameters:
index - position to set the category.
obj - the SyndCategoryImpl object to set.
Returns:
the SyndCategoryImpl object that is being replaced, null if none.

add

public void add(int index,
                java.lang.Object obj)
Adds a category to the list.

Specified by:
add in interface java.util.List
Overrides:
add in class java.util.AbstractList
Parameters:
index - position to add the category.
obj - the SyndCategoryImpl object to add.

remove

public java.lang.Object remove(int index)
Removes a category element from a specific position.

Specified by:
remove in interface java.util.List
Overrides:
remove in class java.util.AbstractList
Parameters:
index - position to remove the category from.
Returns:
the SyndCategoryImpl being removed from position index, null if none.

convertElementsSyndCategoryToSubject

public static java.util.List convertElementsSyndCategoryToSubject(java.util.List cList)
Returns a list with the DCSubject elements of the SyndCategoryImpl list facade. To be used by the SyndFeedImpl class only.

Parameters:
cList - the list with SyndCategoryImpl elements to convert to subject list.
Returns:
a list with DCSubject elements corresponding to the categories in the given list.


Copyright © Sun Microsystems. All Rights Reserved.