From cabbc96078ec4ad6ddce7de5f2dbfd3ed1d1aeb1 Mon Sep 17 00:00:00 2001 From: richie Date: Fri, 9 Aug 2019 17:14:25 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=9F=E4=B8=80=E5=91=BD=E5=90=8D=E8=A7=84?= =?UTF-8?q?=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- readme.md | 11 +++++-- ...ableDataFactory.java => TableDataKit.java} | 2 +- src/main/java/com/fanruan/api/env/EnvKit.java | 29 +++++++++++++++++++ .../{SessionFactory.java => SessionKit.java} | 2 +- .../api/session/SessionFactoryTest.java | 2 +- 5 files changed, 40 insertions(+), 6 deletions(-) rename src/main/java/com/fanruan/api/data/{TableDataFactory.java => TableDataKit.java} (98%) create mode 100644 src/main/java/com/fanruan/api/env/EnvKit.java rename src/main/java/com/fanruan/api/session/{SessionFactory.java => SessionKit.java} (94%) diff --git a/readme.md b/readme.md index fb82832..4db4f40 100644 --- a/readme.md +++ b/readme.md @@ -6,6 +6,7 @@ 比如,要获取报表的会话信息,以前需要调用方法 ```java import com.fr.web.core.SessionPoolManager; +import org.jetbrains.annotations.NotNull; SessionPoolManager#getSessionIDInfor(@NotNull String sessionID, Class clazz); ``` @@ -14,13 +15,17 @@ SessionPoolManager#getSessionIDInfor(@NotNull String sessionID, Class clazz); 而如果采用可开发工具套件中的方法,则始终都是调用 ```java -import com.fanruan.api.session.SessionFactory; +import com.fanruan.api.session.SessionKit; +import org.jetbrains.annotations.NotNull; -SessionFactory#getSession(@NotNull String sessionID); +SessionKit#getSession(@NotNull String sessionID); ``` 仅仅只需要更新最新版本的开发套件工具包即可让老插件自然适配。 ## 提交新API要求 * 所有的API方法的返回值和参数,仅允许使用基本类型或者接口类型。 -* 所有的API方法均需要有单元测试覆盖。 \ No newline at end of file + +* 所有的API方法均需要有单元测试覆盖。 + +* 所有的API方法均需要有javadoc文档说明。 \ No newline at end of file diff --git a/src/main/java/com/fanruan/api/data/TableDataFactory.java b/src/main/java/com/fanruan/api/data/TableDataKit.java similarity index 98% rename from src/main/java/com/fanruan/api/data/TableDataFactory.java rename to src/main/java/com/fanruan/api/data/TableDataKit.java index 66cc8f6..936c9c2 100644 --- a/src/main/java/com/fanruan/api/data/TableDataFactory.java +++ b/src/main/java/com/fanruan/api/data/TableDataKit.java @@ -13,7 +13,7 @@ import org.jetbrains.annotations.NotNull; * Created by richie on 2019-08-09 * 数据集获取工具类 */ -public class TableDataFactory { +public class TableDataKit { /** * 根据名字获取数据集 diff --git a/src/main/java/com/fanruan/api/env/EnvKit.java b/src/main/java/com/fanruan/api/env/EnvKit.java new file mode 100644 index 0000000..d0d9119 --- /dev/null +++ b/src/main/java/com/fanruan/api/env/EnvKit.java @@ -0,0 +1,29 @@ +package com.fanruan.api.env; + +import com.fr.workspace.WorkContext; +import com.fr.workspace.Workspace; +import com.fr.workspace.resource.WorkResource; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-08-09 + */ +public class EnvKit { + + /** + * 获取当前的工作目录 + * @return 工作目录 + */ + public static Workspace getCurrent() { + return WorkContext.getCurrent(); + } + + /** + * 获取当前工作目录的资源读写对象 + * @return 资源读写对象 + */ + public static WorkResource getWorkResource() { + return WorkContext.getWorkResource(); + } +} diff --git a/src/main/java/com/fanruan/api/session/SessionFactory.java b/src/main/java/com/fanruan/api/session/SessionKit.java similarity index 94% rename from src/main/java/com/fanruan/api/session/SessionFactory.java rename to src/main/java/com/fanruan/api/session/SessionKit.java index d8376ad..0ae6c7c 100644 --- a/src/main/java/com/fanruan/api/session/SessionFactory.java +++ b/src/main/java/com/fanruan/api/session/SessionKit.java @@ -9,7 +9,7 @@ import org.jetbrains.annotations.NotNull; * @version 10.0 * Created by richie on 2019-08-09 */ -public class SessionFactory { +public class SessionKit { /** * 根据sessionID信息返回会话对象 diff --git a/src/test/java/com/fanruan/api/session/SessionFactoryTest.java b/src/test/java/com/fanruan/api/session/SessionFactoryTest.java index 3366cf7..2a6b71b 100644 --- a/src/test/java/com/fanruan/api/session/SessionFactoryTest.java +++ b/src/test/java/com/fanruan/api/session/SessionFactoryTest.java @@ -13,6 +13,6 @@ public class SessionFactoryTest extends Prepare { @Test public void getSession() throws Exception { - Assert.assertNull(SessionFactory.getSession("abc")); + Assert.assertNull(SessionKit.getSession("abc")); } } \ No newline at end of file