com.sun.syndication.feed.synd

Class SyndCategoryListFacade

class SyndCategoryListFacade extends 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
List_subjects
Constructor Summary
SyndCategoryListFacade()
Default constructor.
SyndCategoryListFacade(List subjects)
Creates a facade list of categories on top the given subject list.
Method Summary
voidadd(int index, Object obj)
Adds a category to the list.
static ListconvertElementsSyndCategoryToSubject(List cList)
Returns a list with the DCSubject elements of the SyndCategoryImpl list facade.
Objectget(int index)
Gets the category by index.
Objectremove(int index)
Removes a category element from a specific position.
Objectset(int index, Object obj)
Sets a category in an existing position in the list.
intsize()
Returns the size of the list.

Field Detail

_subjects

private List _subjects

Constructor Detail

SyndCategoryListFacade

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

SyndCategoryListFacade

public SyndCategoryListFacade(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

add

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

Parameters: index position to add the category. obj the SyndCategoryImpl object to add.

convertElementsSyndCategoryToSubject

public static List convertElementsSyndCategoryToSubject(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.

get

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

Parameters: index the index position to retrieve the category.

Returns: the SyndCategoryImpl in position index, null if none.

remove

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

Parameters: index position to remove the category from.

Returns: the SyndCategoryImpl being removed from position index, null if none.

set

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

Parameters: index position to set the category. obj the SyndCategoryImpl object to set.

Returns: the SyndCategoryImpl object that is being replaced, null if none.

size

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

Returns: the size of the list.

Copyright © Sun Microsystems. All Rights Reserved.