From e98fd8291668cace55e15800a528c6c218ab95d2 Mon Sep 17 00:00:00 2001 From: LamGC Date: Thu, 3 Sep 2020 18:01:18 +0800 Subject: [PATCH] =?UTF-8?q?[Add][Moved]=20=E8=B0=83=E6=95=B4Converter?= =?UTF-8?q?=E5=8C=85=E8=B7=AF=E5=BE=84,=20=E5=A2=9E=E5=8A=A0StringToString?= =?UTF-8?q?Converter;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [Moved] Converter, StringConverter 调整包路径; [Add] StringToStringConverter 添加简易StringConverter实现; [Change] CacheStoreFactory 适配更改; --- .../cgj/bot/cache/CacheStoreFactory.java | 2 ++ .../bot/cache/{ => convert}/Converter.java | 2 +- .../cache/{ => convert}/StringConverter.java | 2 +- .../convert/StringToStringConverter.java | 35 +++++++++++++++++++ 4 files changed, 39 insertions(+), 2 deletions(-) rename ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/{ => convert}/Converter.java (96%) rename ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/{ => convert}/StringConverter.java (95%) create mode 100644 ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/convert/StringToStringConverter.java diff --git a/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/CacheStoreFactory.java b/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/CacheStoreFactory.java index 59f4573..ca8b3b8 100644 --- a/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/CacheStoreFactory.java +++ b/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/CacheStoreFactory.java @@ -17,6 +17,8 @@ package net.lamgc.cgj.bot.cache; +import net.lamgc.cgj.bot.cache.convert.StringConverter; + /** * 缓存存储容器构造工厂. * 可支持不同实现缓存存储容器. diff --git a/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/Converter.java b/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/convert/Converter.java similarity index 96% rename from ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/Converter.java rename to ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/convert/Converter.java index d45fdae..b957300 100644 --- a/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/Converter.java +++ b/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/convert/Converter.java @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -package net.lamgc.cgj.bot.cache; +package net.lamgc.cgj.bot.cache.convert; /** * 转换器接口 diff --git a/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/StringConverter.java b/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/convert/StringConverter.java similarity index 95% rename from ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/StringConverter.java rename to ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/convert/StringConverter.java index f982de6..73a6342 100644 --- a/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/StringConverter.java +++ b/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/convert/StringConverter.java @@ -15,7 +15,7 @@ * along with this program. If not, see . */ -package net.lamgc.cgj.bot.cache; +package net.lamgc.cgj.bot.cache.convert; /** * 某类型到字符串的转换器接口. diff --git a/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/convert/StringToStringConverter.java b/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/convert/StringToStringConverter.java new file mode 100644 index 0000000..8b59d79 --- /dev/null +++ b/ContentGrabbingJi-CacheStore-api/src/main/java/net/lamgc/cgj/bot/cache/convert/StringToStringConverter.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2020 LamGC + * + * ContentGrabbingJi is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * ContentGrabbingJi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package net.lamgc.cgj.bot.cache.convert; + +/** + * 字符串原样转换的转换器. + * 不进行任何处理. + * @author LamGC + */ +public class StringToStringConverter implements StringConverter { + @Override + public String to(String source) { + return source; + } + + @Override + public String from(String target) { + return target; + } +}