com.seeyon.ctp.common.cache
接口 CacheSet<E extends java.io.Serializable>

所有超级接口:
GroupCacheable

public interface CacheSet<E extends java.io.Serializable>
extends GroupCacheable

Set缓存,管理集合类的缓存,机制同Set。

作者:
wangwy

方法摘要
 boolean add(E o)
          Adds the specified element to this set if it is not already present (optional operation).
 boolean addAll(java.util.Collection<? extends E> c)
          Adds all of the elements in the specified collection to this set if they're not already present (optional operation).
 boolean contains(E o)
          Returns true if this set contains the specified element.
 java.util.Iterator<E> iterator()
          Returns an iterator over the elements in this set.
 void notifyUpdate(E e)
          通知缓存项改变,需要更新。
 boolean remove(E o)
          Removes the specified element from this set if it is present (optional operation).
 boolean removeAll(java.util.Collection<? extends E> c)
          Removes from this set all of its elements that are contained in the specified collection (optional operation).
 void replaceAll(java.util.Collection<? extends E> set)
          清除缓存并将Map中的所有项目设置到缓存中。
 java.util.Set<E> toSet()
          将缓存转化为Set表示。
 
从接口 com.seeyon.ctp.common.cache.GroupCacheable 继承的方法
clear, getGroup, getName, isEmpty, size
 

方法详细信息

contains

boolean contains(E o)
Returns true if this set contains the specified element. More formally, returns true if and only if this set contains an element e such that (o==null ? e==null : o.equals(e)).

参数:
o - element whose presence in this set is to be tested.
返回:
true if this set contains the specified element.
抛出:
java.lang.ClassCastException - if the type of the specified element is incompatible with this set (optional).
java.lang.NullPointerException - if the specified element is null and this set does not support null elements (optional).

iterator

java.util.Iterator<E> iterator()
Returns an iterator over the elements in this set. The elements are returned in no particular order (unless this set is an instance of some class that provides a guarantee).

返回:
an iterator over the elements in this set.

toSet

java.util.Set<E> toSet()
将缓存转化为Set表示。

返回:
包含缓存中的所有对象的Set。

add

boolean add(E o)
Adds the specified element to this set if it is not already present (optional operation). More formally, adds the specified element, o, to this set if this set contains no element e such that (o==null ? e==null : o.equals(e)). If this set already contains the specified element, the call leaves this set unchanged and returns false. In combination with the restriction on constructors, this ensures that sets never contain duplicate elements.

The stipulation above does not imply that sets must accept all elements; sets may refuse to add any particular element, including null, and throwing an exception, as described in the specification for Collection.add. Individual set implementations should clearly document any restrictions on the elements that they may contain.

参数:
o - element to be added to this set.
返回:
true if this set did not already contain the specified element.
抛出:
java.lang.UnsupportedOperationException - if the add method is not supported by this set.
java.lang.ClassCastException - if the class of the specified element prevents it from being added to this set.
java.lang.NullPointerException - if the specified element is null and this set does not support null elements.
java.lang.IllegalArgumentException - if some aspect of the specified element prevents it from being added to this set.

remove

boolean remove(E o)
Removes the specified element from this set if it is present (optional operation). More formally, removes an element e such that (o==null ? e==null : o.equals(e)), if the set contains such an element. Returns true if the set contained the specified element (or equivalently, if the set changed as a result of the call). (The set will not contain the specified element once the call returns.)

参数:
o - object to be removed from this set, if present.
返回:
true if the set contained the specified element.
抛出:
java.lang.ClassCastException - if the type of the specified element is incompatible with this set (optional).
java.lang.NullPointerException - if the specified element is null and this set does not support null elements (optional).
java.lang.UnsupportedOperationException - if the remove method is not supported by this set.

addAll

boolean addAll(java.util.Collection<? extends E> c)
Adds all of the elements in the specified collection to this set if they're not already present (optional operation). If the specified collection is also a set, the addAll operation effectively modifies this set so that its value is the union of the two sets. The behavior of this operation is unspecified if the specified collection is modified while the operation is in progress.

参数:
c - collection whose elements are to be added to this set.
返回:
true if this set changed as a result of the call.
抛出:
java.lang.UnsupportedOperationException - if the addAll method is not supported by this set.
java.lang.ClassCastException - if the class of some element of the specified collection prevents it from being added to this set.
java.lang.NullPointerException - if the specified collection contains one or more null elements and this set does not support null elements, or if the specified collection is null.
java.lang.IllegalArgumentException - if some aspect of some element of the specified collection prevents it from being added to this set.
另请参见:
#add(Object)

replaceAll

void replaceAll(java.util.Collection<? extends E> set)
清除缓存并将Map中的所有项目设置到缓存中。效果相当于先clear再addAll。

参数:
set - Java Set

removeAll

boolean removeAll(java.util.Collection<? extends E> c)
Removes from this set all of its elements that are contained in the specified collection (optional operation). If the specified collection is also a set, this operation effectively modifies this set so that its value is the asymmetric set difference of the two sets.

参数:
c - collection that defines which elements will be removed from this set.
返回:
true if this set changed as a result of the call.
抛出:
java.lang.UnsupportedOperationException - if the removeAll method is not supported by this Collection.
java.lang.ClassCastException - if the types of one or more elements in this set are incompatible with the specified collection (optional).
java.lang.NullPointerException - if this set contains a null element and the specified collection does not support null elements (optional).
java.lang.NullPointerException - if the specified collection is null.
另请参见:
#remove(Object)

notifyUpdate

void notifyUpdate(E e)
通知缓存项改变,需要更新。

参数:
e - 缓存的对象