Package org.silverpeas.core.calendar
Class CategorySet
- java.lang.Object
-
- org.silverpeas.core.calendar.CategorySet
-
- All Implemented Interfaces:
Serializable
@Embeddable public class CategorySet extends Object implements Serializable
The categories in which aPlannableOnCalendar
planned in a calendar is classified. The categories are expected to be managed by thePlannableOnCalendar
itself.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CategorySet()
Constructs an empty cateogries container.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(String categoryId)
Adds a category to aPlannableOnCalendar
.void
addAll(String... categoryIds)
Adds one or several categories to aPlannableOnCalendar
.void
addAll(List<String> categoryIds)
Adds several categories to aPlannableOnCalendar
.void
addAllFrom(CategorySet categories)
Adds to this categories all those from the specified ones.String[]
asArray()
Converts this categories container to an array of category identifiers.List<String>
asList()
Converts this categories container to a list of category identifiers.boolean
contains(String category)
Is the specified category is in the categories of aPlannableOnCalendar
.CategorySet
copy()
Copies this object into anotherCategorySet
instance.boolean
equals(Object o)
int
hashCode()
boolean
isEmpty()
Is there is no any categories set for aPlannableOnCalendar
?void
remove(String categoryId)
Removes a category from the categories of aPlannableOnCalendar
.void
remove(String... categoryIds)
Removes one or several categories from the categories of aPlannableOnCalendar
.void
removeAll(List<String> categoryIds)
Removes several categories from the categories of aPlannableOnCalendar
.Stream<String>
stream()
-
-
-
Method Detail
-
add
public void add(String categoryId)
Adds a category to aPlannableOnCalendar
. The category is specified by its unique identifier (its title for example). If the category is already added, then nothing is done.- Parameters:
categoryId
- the identifier of the category to add.
-
addAll
public void addAll(List<String> categoryIds)
Adds several categories to aPlannableOnCalendar
. The categories are specified by their unique identifier (their title for example). If some of the categories to add are already present, then they are not added.- Parameters:
categoryIds
- the identifiers of the categories to add.
-
addAll
public void addAll(String... categoryIds)
Adds one or several categories to aPlannableOnCalendar
. The categories are specified by their unique identifier (their title for example). If some of the categories to add are already present, then they are not added.- Parameters:
categoryIds
- the identifiers of the categories to add.
-
remove
public void remove(String categoryId)
Removes a category from the categories of aPlannableOnCalendar
. The category is specified by its unique identifier (its title for example). If the category isn't present, then nothing is done.- Parameters:
categoryId
- the identifier of the category to remove.
-
removeAll
public void removeAll(List<String> categoryIds)
Removes several categories from the categories of aPlannableOnCalendar
. The categories are specified by their unique identifier (their title for example). If some of the categories to remove aren't present, then nothing is done with them.- Parameters:
categoryIds
- the identifiers of the categories to remove.
-
remove
public void remove(String... categoryIds)
Removes one or several categories from the categories of aPlannableOnCalendar
. The categories are specified by their unique identifier (their title for example). If some of the categories to remove aren't present, then nothing is done with them.- Parameters:
categoryIds
- the identifiers of the categories to remove.
-
asList
public List<String> asList()
Converts this categories container to a list of category identifiers.- Returns:
- a list of category identifiers.
-
asArray
public String[] asArray()
Converts this categories container to an array of category identifiers.- Returns:
- an array of category identifiers.
-
contains
public boolean contains(String category)
Is the specified category is in the categories of aPlannableOnCalendar
.- Parameters:
category
- a category identifier.- Returns:
- true if the specified category is among the categories of a
PlannableOnCalendar
, false otherwise.
-
isEmpty
public boolean isEmpty()
Is there is no any categories set for aPlannableOnCalendar
?- Returns:
- true if no categories are set, false otherwise.
-
addAllFrom
public void addAllFrom(CategorySet categories)
Adds to this categories all those from the specified ones.- Parameters:
categories
- the categories to add.
-
copy
public CategorySet copy()
Copies this object into anotherCategorySet
instance.- Returns:
- a copy of this object.
-
-