From 6502385641e57e3f62df8f48eaf7324f51fb3422 Mon Sep 17 00:00:00 2001 From: LamGC Date: Thu, 3 Sep 2020 15:40:10 +0800 Subject: [PATCH] =?UTF-8?q?[Change][Fix]=20=E8=B0=83=E6=95=B4=20Collection?= =?UTF-8?q?CacheStore=20=E9=83=A8=E5=88=86=E5=91=BD=E5=90=8D,=20=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E6=B3=9B=E5=9E=8B=E5=A3=B0=E6=98=8E;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [Change] CollectionCacheStore 调整命名, 由 value/values 更名为 element/elements; [Fix] ListCacheStore, SetCacheStore 修复因泛型错误导致的类型错误问题; --- .../cgj/bot/cache/CollectionCacheStore.java | 16 ++++++++-------- .../net/lamgc/cgj/bot/cache/ListCacheStore.java | 4 ++-- .../net/lamgc/cgj/bot/cache/SetCacheStore.java | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/CollectionCacheStore.java b/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/CollectionCacheStore.java index c6e5010..338d85a 100644 --- a/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/CollectionCacheStore.java +++ b/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/CollectionCacheStore.java @@ -30,30 +30,30 @@ public interface CollectionCacheStore extends CacheStore> { * 为缓存项添加一个元素. * 当缓存项不存在时, 将会创建一个新的缓存项. * @param key 缓存项键名. - * @param value 待添加的元素. + * @param element 待添加的元素. * @return 如果成功返回 true. - * @throws NullPointerException 当 key 或 value 为 null 时抛出; 本方法不允许存储 null 值, 因为 null 代表"没有/不存在". + * @throws NullPointerException 当 key 或 element 为 null 时抛出; 本方法不允许存储 null 值, 因为 null 代表"没有/不存在". */ - boolean addElement(String key, E value); + boolean addElement(String key, E element); /** * 为缓存项添加一组元素. * 当缓存项不存在时, 将会创建一个新的缓存项. * @param key 缓存项键名. - * @param values 欲添加的元素集合. + * @param elements 欲添加的元素集合. * @return 如果成功添加, 返回 true, 如果无法添加(例如缓存项 List/Set 长度限制), 返回 false. * @throws NullPointerException 当 key 或 value 为 null 时抛出; 本方法不允许存储 null 值, 因为 null 代表"没有/不存在". */ - boolean addElements(String key, Collection values); + boolean addElements(String key, Collection elements); /** * 检查指定元素是否包含在指定缓存项中. * @param key 待检查的缓存项键名. - * @param value 待查找的缓存值. + * @param element 待查找的缓存值. * @return 如果存在, 返回 true, 如果元素不存在, 或缓存项不存在, 返回 false. - * @throws NullPointerException 当 key 或 value 为 null 时抛出; 本方法不允许存储 null 值, 因为 null 代表"没有/不存在". + * @throws NullPointerException 当 key 或 element 为 null 时抛出; 本方法不允许存储 null 值, 因为 null 代表"没有/不存在". */ - boolean containsElement(String key, E value); + boolean containsElement(String key, E element); /** * 检查指定缓存项是否为空. diff --git a/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/ListCacheStore.java b/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/ListCacheStore.java index 533f99c..cae4923 100644 --- a/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/ListCacheStore.java +++ b/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/ListCacheStore.java @@ -25,7 +25,7 @@ import java.util.List; * @param 值类型. * @author LamGC */ -public interface ListCacheStore extends CollectionCacheStore> { +public interface ListCacheStore extends CollectionCacheStore { /** * 获取缓存项中的指定元素. @@ -68,5 +68,5 @@ public interface ListCacheStore extends CollectionCacheStore> { * @return 如果元素存在且删除成功, 返回 true. */ @Override - boolean removeElement(String key, List element); + boolean removeElement(String key, E element); } diff --git a/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/SetCacheStore.java b/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/SetCacheStore.java index e7b5495..0299125 100644 --- a/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/SetCacheStore.java +++ b/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/SetCacheStore.java @@ -24,7 +24,7 @@ import java.util.Set; * @param 值类型. * @author LamGC */ -public interface SetCacheStore extends CollectionCacheStore> { +public interface SetCacheStore extends CollectionCacheStore {