From 25bdfff02d746659a52e8c542dd2e7ef2df1331a Mon Sep 17 00:00:00 2001 From: richie Date: Mon, 19 Aug 2019 11:55:15 +0800 Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=B1=BB=E7=9A=84=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fanruan/api/conf/HolderKit.java | 75 ++++++++++++++++++- .../com/fanruan/api/conf/impl/ColConf.java | 19 +++++ .../com/fanruan/api/conf/impl/MapConf.java | 19 +++++ .../com/fanruan/api/conf/impl/ObjConf.java | 16 ++++ .../fanruan/api/conf/impl/ObjectColConf.java | 22 ++++++ .../fanruan/api/conf/impl/ObjectMapConf.java | 26 +++++++ .../com/fanruan/api/conf/impl/SimConf.java | 17 +++++ 7 files changed, 191 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/fanruan/api/conf/impl/ColConf.java create mode 100644 src/main/java/com/fanruan/api/conf/impl/MapConf.java create mode 100644 src/main/java/com/fanruan/api/conf/impl/ObjConf.java create mode 100644 src/main/java/com/fanruan/api/conf/impl/ObjectColConf.java create mode 100644 src/main/java/com/fanruan/api/conf/impl/ObjectMapConf.java create mode 100644 src/main/java/com/fanruan/api/conf/impl/SimConf.java diff --git a/src/main/java/com/fanruan/api/conf/HolderKit.java b/src/main/java/com/fanruan/api/conf/HolderKit.java index cb93332..014fa10 100644 --- a/src/main/java/com/fanruan/api/conf/HolderKit.java +++ b/src/main/java/com/fanruan/api/conf/HolderKit.java @@ -1,7 +1,13 @@ package com.fanruan.api.conf; +import com.fanruan.api.conf.impl.ObjConf; +import com.fanruan.api.conf.impl.ObjectColConf; +import com.fanruan.api.conf.impl.ObjectMapConf; +import com.fanruan.api.conf.impl.SimConf; import com.fr.config.holder.Conf; -import com.fr.config.holder.factory.Holders; + +import java.util.Collection; +import java.util.Map; /** * @author richie @@ -11,11 +17,74 @@ import com.fr.config.holder.factory.Holders; */ public class HolderKit { + /** + * 初始化一个基本对象类型的配置 + * @param t 初始值 + * @param 类型 + * @return 配置对象 + */ public static Conf simple(T t) { - return Holders.simple(t); + return new SimConf<>(t); } + /** + * 初始化一个对象类型的配置 + * @param t 初始值 + * @param type 对象class类 + * @param 类型 + * @return 配置对象 + */ public static Conf obj(T t, Class type) { - return Holders.obj(t, type); + return new ObjConf<>(t, type); + } + + /** + * 初始化一个集合类型的配置 + * @param collection 初始值 + * @param type 对象class类型 + * @param 类型 + * @return 配置对象 + */ + public static ObjectColConf> objCollection(Collection collection, Class type) { + return new ObjectColConf<>(collection, type); + } + + /** + * 初始化一个集合类型的配置 + * @param collection 初始值 + * @param type 对象class类型 + * @param order 是否是有序的配置 + * @param 类型 + * @return 配置对象 + */ + public static ObjectColConf> objCollection(Collection collection, Class type, boolean order) { + return new ObjectColConf<>(collection, type, order); + } + + /** + * 初始化一个字典类型的配置 + * @param map 初始值 + * @param keyType 键class类型 + * @param valueType 值class类型 + * @param 键类型 + * @param 值类型 + * @return 配置对象 + */ + public static ObjectMapConf> objMap(Map map, Class keyType, Class valueType) { + return new ObjectMapConf<>(map, keyType, valueType); + } + + /** + * 初始化一个字典类型的配置 + * @param map 初始值 + * @param keyType 键class类型 + * @param valueType 值class类型 + * @param order 是否是有序配置 + * @param 键类型 + * @param 值类型 + * @return 配置对象 + */ + public static ObjectMapConf> objMap(Map map, Class keyType, Class valueType, boolean order) { + return new ObjectMapConf<>(map, keyType, valueType, order); } } diff --git a/src/main/java/com/fanruan/api/conf/impl/ColConf.java b/src/main/java/com/fanruan/api/conf/impl/ColConf.java new file mode 100644 index 0000000..77718d6 --- /dev/null +++ b/src/main/java/com/fanruan/api/conf/impl/ColConf.java @@ -0,0 +1,19 @@ +package com.fanruan.api.conf.impl; + +import java.util.Collection; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-08-19 + */ +public class ColConf extends com.fr.config.holder.impl.ColConf { + + public ColConf(String property, Collection collection, Class valueType) { + super(property, collection, valueType); + } + + public ColConf(Collection collection, Class valueType) { + super(collection, valueType); + } +} diff --git a/src/main/java/com/fanruan/api/conf/impl/MapConf.java b/src/main/java/com/fanruan/api/conf/impl/MapConf.java new file mode 100644 index 0000000..1bbf120 --- /dev/null +++ b/src/main/java/com/fanruan/api/conf/impl/MapConf.java @@ -0,0 +1,19 @@ +package com.fanruan.api.conf.impl; + +import java.util.Map; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-08-19 + */ +public class MapConf extends com.fr.config.holder.impl.MapConf { + + public MapConf(String property, Map map, Class keyType, Class valueType) { + super(property, map, keyType, valueType); + } + + public MapConf(Map map, Class keyType, Class valueType) { + super(map, keyType, valueType); + } +} diff --git a/src/main/java/com/fanruan/api/conf/impl/ObjConf.java b/src/main/java/com/fanruan/api/conf/impl/ObjConf.java new file mode 100644 index 0000000..57c3d71 --- /dev/null +++ b/src/main/java/com/fanruan/api/conf/impl/ObjConf.java @@ -0,0 +1,16 @@ +package com.fanruan.api.conf.impl; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-08-19 + */ +public class ObjConf extends com.fr.config.holder.impl.ObjConf { + public ObjConf(String property, T t, Class classType) { + super(property, t, classType); + } + + public ObjConf(T t, Class classType) { + super(t, classType); + } +} diff --git a/src/main/java/com/fanruan/api/conf/impl/ObjectColConf.java b/src/main/java/com/fanruan/api/conf/impl/ObjectColConf.java new file mode 100644 index 0000000..0c175c0 --- /dev/null +++ b/src/main/java/com/fanruan/api/conf/impl/ObjectColConf.java @@ -0,0 +1,22 @@ +package com.fanruan.api.conf.impl; + +import java.util.Collection; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-08-19 + */ +public class ObjectColConf extends com.fr.config.holder.impl.ObjectColConf { + public ObjectColConf(String property, Collection collection, Class valueType) { + super(property, collection, valueType); + } + + public ObjectColConf(Collection collection, Class valueType) { + super(collection, valueType); + } + + public ObjectColConf(Collection collection, Class valueType, boolean order) { + super(collection, valueType, order); + } +} diff --git a/src/main/java/com/fanruan/api/conf/impl/ObjectMapConf.java b/src/main/java/com/fanruan/api/conf/impl/ObjectMapConf.java new file mode 100644 index 0000000..22280cd --- /dev/null +++ b/src/main/java/com/fanruan/api/conf/impl/ObjectMapConf.java @@ -0,0 +1,26 @@ +package com.fanruan.api.conf.impl; + +import java.util.Map; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-08-19 + */ +public class ObjectMapConf extends com.fr.config.holder.impl.ObjectMapConf { + public ObjectMapConf(String property, Map map, Class keyType, Class valueType) { + super(property, map, keyType, valueType); + } + + public ObjectMapConf(String property, Map map, Class keyType, Class valueType, boolean order) { + super(property, map, keyType, valueType, order); + } + + public ObjectMapConf(Map map, Class keyType, Class valueType, boolean order) { + super(map, keyType, valueType, order); + } + + public ObjectMapConf(Map map, Class keyType, Class valueType) { + super(map, keyType, valueType); + } +} diff --git a/src/main/java/com/fanruan/api/conf/impl/SimConf.java b/src/main/java/com/fanruan/api/conf/impl/SimConf.java new file mode 100644 index 0000000..15e320c --- /dev/null +++ b/src/main/java/com/fanruan/api/conf/impl/SimConf.java @@ -0,0 +1,17 @@ +package com.fanruan.api.conf.impl; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-08-19 + */ +public class SimConf extends com.fr.config.holder.impl.SimConf { + + public SimConf(T t) { + super(t); + } + + public SimConf(String property, T t) { + super(property, t); + } +}