From b9b9c7042a06f8f4ff373ae26ffb3bad478de5e7 Mon Sep 17 00:00:00 2001 From: zjz1993 <1429595365@qq.com> Date: Wed, 4 Sep 2019 10:56:13 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E6=96=B0=E5=A2=9E=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=8F=8ApluginKit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fanruan/api/err/TableDataException.java | 14 ++++++++++ .../com/fanruan/api/plugin/PluginKit.java | 26 +++++++++++++++++++ .../com/fanruan/api/plugin/PluginKitTest.java | 13 ++++++++++ .../fanruan/api/plugin/TestExtraClass.java | 12 +++++++++ .../com/fanruan/api/util/ArrayKitTest.java | 1 - 5 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/fanruan/api/err/TableDataException.java create mode 100644 src/main/java/com/fanruan/api/plugin/PluginKit.java create mode 100644 src/test/java/com/fanruan/api/plugin/PluginKitTest.java create mode 100644 src/test/java/com/fanruan/api/plugin/TestExtraClass.java diff --git a/src/main/java/com/fanruan/api/err/TableDataException.java b/src/main/java/com/fanruan/api/err/TableDataException.java new file mode 100644 index 0000000..aa222be --- /dev/null +++ b/src/main/java/com/fanruan/api/err/TableDataException.java @@ -0,0 +1,14 @@ +package com.fanruan.api.err; + +/** + * 和数据集工具有关的异常 + * */ +public class TableDataException extends com.fr.general.data.TableDataException{ + public TableDataException(String msg){ + super(msg); + } + + public TableDataException (String msg, Throwable error){ + super(msg, error); + } +} diff --git a/src/main/java/com/fanruan/api/plugin/PluginKit.java b/src/main/java/com/fanruan/api/plugin/PluginKit.java new file mode 100644 index 0000000..d591197 --- /dev/null +++ b/src/main/java/com/fanruan/api/plugin/PluginKit.java @@ -0,0 +1,26 @@ +package com.fanruan.api.plugin; + +import com.fr.plugin.ExtraClassManager; +import com.fr.stable.fun.mark.Mutable; + +import java.util.Set; + +public class PluginKit { + /** + * 返回指定集合的不可变数组 + * @param string 字符串 + * @return 数组 + * */ + public Set getArray(String string) { + return ExtraClassManager.getInstance().getArray(string); + } + + /** + * 返回指定集合的不可变数组 + * @param string 字符串 + * @return 数组 + * */ + public Set getArray(String string, Mutable m) { + return ExtraClassManager.getInstance().getArray(string, m); + } +} diff --git a/src/test/java/com/fanruan/api/plugin/PluginKitTest.java b/src/test/java/com/fanruan/api/plugin/PluginKitTest.java new file mode 100644 index 0000000..4c8a72f --- /dev/null +++ b/src/test/java/com/fanruan/api/plugin/PluginKitTest.java @@ -0,0 +1,13 @@ +package com.fanruan.api.plugin; + +import org.junit.Assert; +import org.junit.Test; + +public class PluginKitTest { + @Test + public void getArray(){ + PluginKit p1 = new PluginKit(); + TestExtraClass p2 = new TestExtraClass(); + Assert.assertEquals(p1.getArray("abcd"), p2.getArray("abcd")); + } +} diff --git a/src/test/java/com/fanruan/api/plugin/TestExtraClass.java b/src/test/java/com/fanruan/api/plugin/TestExtraClass.java new file mode 100644 index 0000000..f81ed57 --- /dev/null +++ b/src/test/java/com/fanruan/api/plugin/TestExtraClass.java @@ -0,0 +1,12 @@ +package com.fanruan.api.plugin; +import com.fr.plugin.injectable.PluginSingleInjection; + +public class TestExtraClass extends com.fr.plugin.AbstractExtraClassManager{ + protected boolean mountSpecific(PluginSingleInjection injection){ + return true; + } + + protected boolean demountSpecific(PluginSingleInjection injection){ + return true; + } +} diff --git a/src/test/java/com/fanruan/api/util/ArrayKitTest.java b/src/test/java/com/fanruan/api/util/ArrayKitTest.java index 054ae22..715ecfd 100644 --- a/src/test/java/com/fanruan/api/util/ArrayKitTest.java +++ b/src/test/java/com/fanruan/api/util/ArrayKitTest.java @@ -3,7 +3,6 @@ package com.fanruan.api.util; import com.fanruan.api.Prepare; import java.util.*; -import com.fr.third.org.apache.poi.hssf.record.formula.functions.Int; import org.junit.Assert; import org.junit.Test;