context) {
+ return ScriptVariableManager.getRegistered(context.getEngineName());
+ }
+
@Override
public String describe() {
return "script-" + getType() + "-" + super.describe();
diff --git a/smart-flow-core/src/main/java/org/smartboot/flow/core/script/ScriptConstants.java b/smart-flow-core/src/main/java/org/smartboot/flow/core/script/ScriptConstants.java
index 8d20f40..0122203 100644
--- a/smart-flow-core/src/main/java/org/smartboot/flow/core/script/ScriptConstants.java
+++ b/smart-flow-core/src/main/java/org/smartboot/flow/core/script/ScriptConstants.java
@@ -23,4 +23,11 @@ public interface ScriptConstants {
* Flow engine execution context.
*/
String CONTEXT = "context";
+
+ /**
+ * Alias for context.
+ *
+ * @since 1.0.5
+ */
+ String CTX = "ctx";
}
diff --git a/smart-flow-core/src/main/java/org/smartboot/flow/core/script/ScriptVariableManager.java b/smart-flow-core/src/main/java/org/smartboot/flow/core/script/ScriptVariableManager.java
new file mode 100644
index 0000000..d6199cb
--- /dev/null
+++ b/smart-flow-core/src/main/java/org/smartboot/flow/core/script/ScriptVariableManager.java
@@ -0,0 +1,60 @@
+package org.smartboot.flow.core.script;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ *
+ * 1、提供全局脚本变量注册
+ * 2、提供基于引擎维度的脚本变量注册
+ *
+ *
+ * @author qinluo
+ * @date 2023-01-17 19:41
+ * @since 1.0.5
+ */
+public class ScriptVariableManager {
+
+ /**
+ * 全局脚本变量注册
+ */
+ private static final Map GLOBAL = new ConcurrentHashMap<>();
+
+ /**
+ * 引擎维度脚本变量注册
+ */
+ private static final Map> ENGINE_VARIABLES = new ConcurrentHashMap<>();
+
+ public static void register(String key, Object variable) {
+ GLOBAL.put(key, variable);
+ }
+
+ public static Object remove(String key) {
+ return GLOBAL.remove(key);
+ }
+
+ public synchronized static void register(String engine, String key, Object variable) {
+ Map variables = ENGINE_VARIABLES.getOrDefault(engine, new ConcurrentHashMap<>());
+ variables.put(key, variable);
+ ENGINE_VARIABLES.put(engine, variables);
+ }
+
+ public static Object remove(String engine, String key) {
+ Map variables = ENGINE_VARIABLES.get(engine);
+ if (variables != null) {
+ return variables.remove(key);
+ }
+
+ return null;
+ }
+
+ public static Map getRegistered(String engine) {
+ Map allRegistered = new HashMap<>(GLOBAL);
+ Map variables = ENGINE_VARIABLES.get(engine);
+ if (variables != null) {
+ allRegistered.putAll(variables);
+ }
+ return allRegistered;
+ }
+}
diff --git a/smart-flow-helper/pom.xml b/smart-flow-helper/pom.xml
new file mode 100644
index 0000000..3653215
--- /dev/null
+++ b/smart-flow-helper/pom.xml
@@ -0,0 +1,27 @@
+
+
+
+ smart-flow-parent
+ org.smartboot.flow
+ 1.0.5-SNAPSHOT
+
+ 4.0.0
+
+ smart-flow-helper
+
+
+ 8
+ 8
+
+
+
+
+ org.smartboot.flow
+ smart-flow-core
+ 1.0.5-SNAPSHOT
+
+
+
+
\ No newline at end of file
diff --git a/smart-flow-core/src/main/java/org/smartboot/flow/core/useful/AbstractEngineQuery.java b/smart-flow-helper/src/main/java/org/smartboot/flow/helper/useful/AbstractEngineQuery.java
similarity index 90%
rename from smart-flow-core/src/main/java/org/smartboot/flow/core/useful/AbstractEngineQuery.java
rename to smart-flow-helper/src/main/java/org/smartboot/flow/helper/useful/AbstractEngineQuery.java
index b7bdbd6..bbf1645 100644
--- a/smart-flow-core/src/main/java/org/smartboot/flow/core/useful/AbstractEngineQuery.java
+++ b/smart-flow-helper/src/main/java/org/smartboot/flow/helper/useful/AbstractEngineQuery.java
@@ -1,4 +1,4 @@
-package org.smartboot.flow.core.useful;
+package org.smartboot.flow.helper.useful;
import java.io.Serializable;
diff --git a/smart-flow-core/src/main/java/org/smartboot/flow/core/useful/AbstractExecutorSelector.java b/smart-flow-helper/src/main/java/org/smartboot/flow/helper/useful/AbstractExecutorSelector.java
similarity index 96%
rename from smart-flow-core/src/main/java/org/smartboot/flow/core/useful/AbstractExecutorSelector.java
rename to smart-flow-helper/src/main/java/org/smartboot/flow/helper/useful/AbstractExecutorSelector.java
index eae0904..857824e 100644
--- a/smart-flow-core/src/main/java/org/smartboot/flow/core/useful/AbstractExecutorSelector.java
+++ b/smart-flow-helper/src/main/java/org/smartboot/flow/helper/useful/AbstractExecutorSelector.java
@@ -1,4 +1,4 @@
-package org.smartboot.flow.core.useful;
+package org.smartboot.flow.helper.useful;
import org.smartboot.flow.core.FlowEngine;
diff --git a/smart-flow-core/src/main/java/org/smartboot/flow/core/useful/DefaultEngineQuery.java b/smart-flow-helper/src/main/java/org/smartboot/flow/helper/useful/DefaultEngineQuery.java
similarity index 91%
rename from smart-flow-core/src/main/java/org/smartboot/flow/core/useful/DefaultEngineQuery.java
rename to smart-flow-helper/src/main/java/org/smartboot/flow/helper/useful/DefaultEngineQuery.java
index 4c9cca2..9e382e1 100644
--- a/smart-flow-core/src/main/java/org/smartboot/flow/core/useful/DefaultEngineQuery.java
+++ b/smart-flow-helper/src/main/java/org/smartboot/flow/helper/useful/DefaultEngineQuery.java
@@ -1,4 +1,4 @@
-package org.smartboot.flow.core.useful;
+package org.smartboot.flow.helper.useful;
/**
* 通过engineName查询engine
diff --git a/smart-flow-core/src/main/java/org/smartboot/flow/core/useful/DefaultExecutorSelector.java b/smart-flow-helper/src/main/java/org/smartboot/flow/helper/useful/DefaultExecutorSelector.java
similarity index 93%
rename from smart-flow-core/src/main/java/org/smartboot/flow/core/useful/DefaultExecutorSelector.java
rename to smart-flow-helper/src/main/java/org/smartboot/flow/helper/useful/DefaultExecutorSelector.java
index db681dc..0b1c2e2 100644
--- a/smart-flow-core/src/main/java/org/smartboot/flow/core/useful/DefaultExecutorSelector.java
+++ b/smart-flow-helper/src/main/java/org/smartboot/flow/helper/useful/DefaultExecutorSelector.java
@@ -1,4 +1,4 @@
-package org.smartboot.flow.core.useful;
+package org.smartboot.flow.helper.useful;
import org.smartboot.flow.core.FlowEngine;
diff --git a/smart-flow-core/src/main/java/org/smartboot/flow/core/useful/EngineExecutorManager.java b/smart-flow-helper/src/main/java/org/smartboot/flow/helper/useful/EngineExecutorManager.java
similarity index 98%
rename from smart-flow-core/src/main/java/org/smartboot/flow/core/useful/EngineExecutorManager.java
rename to smart-flow-helper/src/main/java/org/smartboot/flow/helper/useful/EngineExecutorManager.java
index 4a26934..4ee6b0b 100644
--- a/smart-flow-core/src/main/java/org/smartboot/flow/core/useful/EngineExecutorManager.java
+++ b/smart-flow-helper/src/main/java/org/smartboot/flow/helper/useful/EngineExecutorManager.java
@@ -1,4 +1,4 @@
-package org.smartboot.flow.core.useful;
+package org.smartboot.flow.helper.useful;
diff --git a/smart-flow-core/src/main/java/org/smartboot/flow/core/useful/ExecutorSelector.java b/smart-flow-helper/src/main/java/org/smartboot/flow/helper/useful/ExecutorSelector.java
similarity index 92%
rename from smart-flow-core/src/main/java/org/smartboot/flow/core/useful/ExecutorSelector.java
rename to smart-flow-helper/src/main/java/org/smartboot/flow/helper/useful/ExecutorSelector.java
index 7236ff8..7415f40 100644
--- a/smart-flow-core/src/main/java/org/smartboot/flow/core/useful/ExecutorSelector.java
+++ b/smart-flow-helper/src/main/java/org/smartboot/flow/helper/useful/ExecutorSelector.java
@@ -1,4 +1,4 @@
-package org.smartboot.flow.core.useful;
+package org.smartboot.flow.helper.useful;
import org.smartboot.flow.core.FlowEngine;
diff --git a/smart-flow-manager/pom.xml b/smart-flow-manager/pom.xml
index 307564e..89b2328 100644
--- a/smart-flow-manager/pom.xml
+++ b/smart-flow-manager/pom.xml
@@ -5,7 +5,7 @@
smart-flow-parent
org.smartboot.flow
- 1.0.4
+ 1.0.5-SNAPSHOT
4.0.0
@@ -20,14 +20,7 @@
org.smartboot.flow
smart-flow-core
- 1.0.4
-
-
-
- org.smartboot.flow
- smart-flow-spring-extension
- 1.0.4
- true
+ 1.0.5-SNAPSHOT
@@ -39,7 +32,7 @@
com.alibaba
fastjson
- 2.0.20.graal
+ 2.0.22
diff --git a/smart-flow-script-condition/pom.xml b/smart-flow-script-condition/pom.xml
index 210a90a..84b170b 100644
--- a/smart-flow-script-condition/pom.xml
+++ b/smart-flow-script-condition/pom.xml
@@ -5,7 +5,7 @@
smart-flow-parent
org.smartboot.flow
- 1.0.4
+ 1.0.5-SNAPSHOT
4.0.0
pom
@@ -27,7 +27,7 @@
org.smartboot.flow
smart-flow-core
- 1.0.4
+ 1.0.5-SNAPSHOT
diff --git a/smart-flow-script-condition/smart-flow-script-groovy/pom.xml b/smart-flow-script-condition/smart-flow-script-groovy/pom.xml
index 572064d..f2a16f6 100644
--- a/smart-flow-script-condition/smart-flow-script-groovy/pom.xml
+++ b/smart-flow-script-condition/smart-flow-script-groovy/pom.xml
@@ -5,7 +5,7 @@
smart-flow-script-condition
org.smartboot.flow
- 1.0.4
+ 1.0.5-SNAPSHOT
4.0.0
diff --git a/smart-flow-script-condition/smart-flow-script-groovy/src/main/java/org/smartboot/flow/condition/extension/groovy/GroovyScriptCondition.java b/smart-flow-script-condition/smart-flow-script-groovy/src/main/java/org/smartboot/flow/condition/extension/groovy/GroovyScriptCondition.java
index b464d08..83d2cfd 100644
--- a/smart-flow-script-condition/smart-flow-script-groovy/src/main/java/org/smartboot/flow/condition/extension/groovy/GroovyScriptCondition.java
+++ b/smart-flow-script-condition/smart-flow-script-groovy/src/main/java/org/smartboot/flow/condition/extension/groovy/GroovyScriptCondition.java
@@ -10,6 +10,7 @@ import org.smartboot.flow.core.script.ScriptConstants;
import javax.script.Bindings;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
+import java.util.Map;
/**
* @author qinluo
@@ -33,6 +34,12 @@ public class GroovyScriptCondition extends ScriptCondition {
data.put(ScriptConstants.REQ, engineContext.getReq());
data.put(ScriptConstants.RESULT, engineContext.getResult());
data.put(ScriptConstants.CONTEXT, engineContext);
+ data.put(ScriptConstants.CTX, engineContext);
+
+ Map variables = super.bindCustomized(engineContext);
+ if (variables != null) {
+ data.putAll(variables);
+ }
Object value = engine.eval(script, data);
if (LOGGER.isDebugEnabled()) {
diff --git a/smart-flow-script-condition/smart-flow-script-ognl/pom.xml b/smart-flow-script-condition/smart-flow-script-ognl/pom.xml
index 139a2ea..94d83ab 100644
--- a/smart-flow-script-condition/smart-flow-script-ognl/pom.xml
+++ b/smart-flow-script-condition/smart-flow-script-ognl/pom.xml
@@ -5,7 +5,7 @@
smart-flow-script-condition
org.smartboot.flow
- 1.0.4
+ 1.0.5-SNAPSHOT
4.0.0
diff --git a/smart-flow-script-condition/smart-flow-script-ognl/src/main/java/org/smartboot/flow/condition/extension/ognl/OgnlScriptCondition.java b/smart-flow-script-condition/smart-flow-script-ognl/src/main/java/org/smartboot/flow/condition/extension/ognl/OgnlScriptCondition.java
index e930fcc..bf70ddb 100644
--- a/smart-flow-script-condition/smart-flow-script-ognl/src/main/java/org/smartboot/flow/condition/extension/ognl/OgnlScriptCondition.java
+++ b/smart-flow-script-condition/smart-flow-script-ognl/src/main/java/org/smartboot/flow/condition/extension/ognl/OgnlScriptCondition.java
@@ -27,6 +27,12 @@ public class OgnlScriptCondition extends ScriptCondition {
context.put(ScriptConstants.REQ, engineContext.getReq());
context.put(ScriptConstants.RESULT, engineContext.getResult());
context.put(ScriptConstants.CONTEXT, engineContext);
+ context.put(ScriptConstants.CTX, engineContext);
+
+ Map variables = super.bindCustomized(engineContext);
+ if (variables != null) {
+ context.putAll(variables);
+ }
Object value = Ognl.getValue(script, context);
if (LOGGER.isDebugEnabled()) {
diff --git a/smart-flow-script-condition/smart-flow-script-qlexpress/pom.xml b/smart-flow-script-condition/smart-flow-script-qlexpress/pom.xml
index 2aec95a..cbca1b6 100644
--- a/smart-flow-script-condition/smart-flow-script-qlexpress/pom.xml
+++ b/smart-flow-script-condition/smart-flow-script-qlexpress/pom.xml
@@ -5,7 +5,7 @@
smart-flow-script-condition
org.smartboot.flow
- 1.0.4
+ 1.0.5-SNAPSHOT
4.0.0
diff --git a/smart-flow-script-condition/smart-flow-script-qlexpress/src/main/java/org/smartboot/flow/condition/extension/qlexpress/QlExpressScriptCondition.java b/smart-flow-script-condition/smart-flow-script-qlexpress/src/main/java/org/smartboot/flow/condition/extension/qlexpress/QlExpressScriptCondition.java
index 4623cc4..a3bff74 100644
--- a/smart-flow-script-condition/smart-flow-script-qlexpress/src/main/java/org/smartboot/flow/condition/extension/qlexpress/QlExpressScriptCondition.java
+++ b/smart-flow-script-condition/smart-flow-script-qlexpress/src/main/java/org/smartboot/flow/condition/extension/qlexpress/QlExpressScriptCondition.java
@@ -9,6 +9,8 @@ import org.smartboot.flow.core.exception.FlowException;
import org.smartboot.flow.core.script.ScriptCondition;
import org.smartboot.flow.core.script.ScriptConstants;
+import java.util.Map;
+
/**
* @author qinluo
* @date 2022/11/29 21:01
@@ -26,6 +28,12 @@ public class QlExpressScriptCondition extends ScriptCondition {
qlContext.put(ScriptConstants.REQ, engineContext.getReq());
qlContext.put(ScriptConstants.RESULT, engineContext.getResult());
qlContext.put(ScriptConstants.CONTEXT, engineContext);
+ qlContext.put(ScriptConstants.CTX, engineContext);
+
+ Map variables = super.bindCustomized(engineContext);
+ if (variables != null) {
+ qlContext.putAll(variables);
+ }
ExpressRunner runner = new ExpressRunner();
Object value = runner.execute(script, qlContext, null, true, false);
diff --git a/smart-flow-spring-extension/pom.xml b/smart-flow-spring-extension/pom.xml
index ceef2f0..0d06ca6 100644
--- a/smart-flow-spring-extension/pom.xml
+++ b/smart-flow-spring-extension/pom.xml
@@ -5,7 +5,7 @@
smart-flow-parent
org.smartboot.flow
- 1.0.4
+ 1.0.5-SNAPSHOT
4.0.0
@@ -18,10 +18,11 @@
+
org.smartboot.flow
- smart-flow-core
- 1.0.4
+ smart-flow-manager
+ 1.0.5-SNAPSHOT
@@ -37,43 +38,10 @@
${spring.version}
-
- org.springframework
- spring-orm
- ${spring.version}
-
-
-
- org.springframework
- spring-aop
- ${spring.version}
-
-
org.springframework
spring-beans
${spring.version}
-
- org.springframework
- spring-test
- 5.2.4.RELEASE
- test
-
-
-
-
- org.junit.jupiter
- junit-jupiter-api
- 5.9.1
- test
-
-
-
- org.junit.jupiter
- junit-jupiter-engine
- 5.9.1
- test
-
\ No newline at end of file
diff --git a/smart-flow-springboot-starter/pom.xml b/smart-flow-springboot-starter/pom.xml
index aa357a5..365a1c6 100644
--- a/smart-flow-springboot-starter/pom.xml
+++ b/smart-flow-springboot-starter/pom.xml
@@ -5,7 +5,7 @@
smart-flow-parent
org.smartboot.flow
- 1.0.4
+ 1.0.5-SNAPSHOT
4.0.0
@@ -25,12 +25,7 @@
org.smartboot.flow
smart-flow-spring-extension
- 1.0.4
-
-
- org.smartboot.flow
- smart-flow-manager
- 1.0.4
+ 1.0.5-SNAPSHOT
--
Gitee
From 80b99d1267e067557135ffe3daf210a409e2a9df Mon Sep 17 00:00:00 2001
From: qinluo <1558642210@qq.com>
Date: Fri, 27 Jan 2023 12:42:41 +0800
Subject: [PATCH 02/20] =?UTF-8?q?qinluo:=20=20=20=20=20=20-=20ObjectCreato?=
=?UTF-8?q?r=E6=94=B9=E9=80=A0=20=20=20=20=20=20-=20FakeObjectCreator?=
=?UTF-8?q?=E5=BC=80=E5=8F=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../attribute/AttributeValueResolver.java | 2 +-
.../core/parser/BuilderDefinitionVisitor.java | 30 +++++++---------
.../core/parser/DefaultObjectCreator.java | 2 +-
.../flow/core/parser/ObjectCreator.java | 10 +++---
.../flow/helper/mock/FakeAdapter.java | 36 +++++++++++++++++++
.../flow/helper/mock/FakeCondition.java | 24 +++++++++++++
.../flow/helper/mock/FakeExecutable.java | 24 +++++++++++++
.../flow/helper/mock/FakeObjectCreator.java | 18 ++++++++++
.../flow/helper/mock/FakeScriptCondition.java | 36 +++++++++++++++++++
.../spring/extension/SpringObjectCreator.java | 4 +--
10 files changed, 160 insertions(+), 26 deletions(-)
create mode 100644 smart-flow-helper/src/main/java/org/smartboot/flow/helper/mock/FakeAdapter.java
create mode 100644 smart-flow-helper/src/main/java/org/smartboot/flow/helper/mock/FakeCondition.java
create mode 100644 smart-flow-helper/src/main/java/org/smartboot/flow/helper/mock/FakeExecutable.java
create mode 100644 smart-flow-helper/src/main/java/org/smartboot/flow/helper/mock/FakeObjectCreator.java
create mode 100644 smart-flow-helper/src/main/java/org/smartboot/flow/helper/mock/FakeScriptCondition.java
diff --git a/smart-flow-core/src/main/java/org/smartboot/flow/core/attribute/AttributeValueResolver.java b/smart-flow-core/src/main/java/org/smartboot/flow/core/attribute/AttributeValueResolver.java
index 9c53a80..368a153 100644
--- a/smart-flow-core/src/main/java/org/smartboot/flow/core/attribute/AttributeValueResolver.java
+++ b/smart-flow-core/src/main/java/org/smartboot/flow/core/attribute/AttributeValueResolver.java
@@ -100,7 +100,7 @@ public class AttributeValueResolver {
// for classname.
try {
- return objectCreator.create(strValue, true);
+ return objectCreator.create(strValue, null,true);
} catch (Exception ignored) {
// Maybe not a class.
}
diff --git a/smart-flow-core/src/main/java/org/smartboot/flow/core/parser/BuilderDefinitionVisitor.java b/smart-flow-core/src/main/java/org/smartboot/flow/core/parser/BuilderDefinitionVisitor.java
index 1ee33c1..6fbbd40 100644
--- a/smart-flow-core/src/main/java/org/smartboot/flow/core/parser/BuilderDefinitionVisitor.java
+++ b/smart-flow-core/src/main/java/org/smartboot/flow/core/parser/BuilderDefinitionVisitor.java
@@ -61,9 +61,9 @@ public class BuilderDefinitionVisitor implements DefinitionVisitor {
Class> javaType = sed.getJavaType();
ScriptCondition condition;
if (javaType != null) {
- condition = objectCreator.create(javaType.getName(), true);
+ condition = objectCreator.create(javaType.getName(), ScriptCondition.class, true);
} else {
- condition = objectCreator.create(sed.getType(), true);
+ condition = objectCreator.create(sed.getType(), ScriptCondition.class, true);
}
condition.setName(sed.getName());
@@ -155,16 +155,12 @@ public class BuilderDefinitionVisitor implements DefinitionVisitor {
// resolve value type.
builder.apply(p.getAttribute(), p.getValue());
});
- Component, ?> component = builder.newAdapter((Executable) newInstance(ed.getExecute()));
+ Component, ?> component = builder.newAdapter(newInstance(ed.getExecute(), Executable.class));
namedComponents.put(ed.getIdentifier(), component);
}
- private Object newInstance(String type) {
- try {
- return objectCreator.create(type, useCache);
- } catch (Exception e) {
- throw new IllegalStateException(type, e);
- }
+ private T newInstance(String type, Class expectType) {
+ return objectCreator.create(type, expectType, useCache);
}
@Override
@@ -172,11 +168,11 @@ public class BuilderDefinitionVisitor implements DefinitionVisitor {
String test = ed.getTest();
Condition condition;
if (AuxiliaryUtils.isType(test)) {
- condition = (Condition) newInstance(test);
+ condition = newInstance(test, Condition.class);
} else if (ed.getContext().getRegistered(test) != null) {
condition = getInternalObject(test, ed.getContext());
} else {
- condition = (Condition) newInstance(test);
+ condition = newInstance(test, Condition.class);
}
AssertUtil.notNull(condition, "can't find condition for if-element, test = " + test);
@@ -212,11 +208,11 @@ public class BuilderDefinitionVisitor implements DefinitionVisitor {
String test = ed.getTest();
Condition condition;
if (AuxiliaryUtils.isType(test)) {
- condition = (Condition) newInstance(test);
+ condition = newInstance(test, Condition.class);
} else if (ed.getContext().getRegistered(test) != null) {
condition = getInternalObject(test, ed.getContext());
} else {
- condition = (Condition) newInstance(test);
+ condition = newInstance(test, Condition.class);
}
AssertUtil.notNull(condition, "can't find condition for choose-element, test = " + test);
@@ -254,18 +250,16 @@ public class BuilderDefinitionVisitor implements DefinitionVisitor {
@Override
public void visit(AdapterDefinition ed) {
String execute = ed.getExecute();
- Object adapter;
+ Adapter adapter = null;
if (AuxiliaryUtils.isType(execute)) {
- adapter = newInstance(execute);
- } else {
- adapter = ed.getContext().getRegistered(execute);
+ adapter = newInstance(execute, Adapter.class);
}
AssertUtil.notNull(adapter, "can't find adapter , execute=" + execute);
ed.getPipelineElement().visit(this);
Component, ?> component = namedComponents.get(ed.getPipelineElement().getIdentifier());
- AdapterBuilder adapterBuilder = new AdapterBuilder((Adapter) adapter, component);
+ AdapterBuilder adapterBuilder = new AdapterBuilder(adapter, component);
ed.getAttributes().forEach(p -> {
// resolve value type.
adapterBuilder.apply(p.getAttribute(), p.getValue());
diff --git a/smart-flow-core/src/main/java/org/smartboot/flow/core/parser/DefaultObjectCreator.java b/smart-flow-core/src/main/java/org/smartboot/flow/core/parser/DefaultObjectCreator.java
index 66df9a7..e5247d1 100644
--- a/smart-flow-core/src/main/java/org/smartboot/flow/core/parser/DefaultObjectCreator.java
+++ b/smart-flow-core/src/main/java/org/smartboot/flow/core/parser/DefaultObjectCreator.java
@@ -30,7 +30,7 @@ public class DefaultObjectCreator implements ObjectCreator {
}
@Override
- public T create(String typename, boolean useCache) {
+ public T create(String typename, Class expectType, boolean useCache) {
AssertUtil.notBlank(typename, "type must not be blank!");
Class type = check(typename);
AssertUtil.notNull(type, "typename " + typename + " is not class");
diff --git a/smart-flow-core/src/main/java/org/smartboot/flow/core/parser/ObjectCreator.java b/smart-flow-core/src/main/java/org/smartboot/flow/core/parser/ObjectCreator.java
index a2a837b..c2dea2c 100644
--- a/smart-flow-core/src/main/java/org/smartboot/flow/core/parser/ObjectCreator.java
+++ b/smart-flow-core/src/main/java/org/smartboot/flow/core/parser/ObjectCreator.java
@@ -10,9 +10,11 @@ public interface ObjectCreator {
/**
* Create an instance with specific type.
*
- * @param type type
- * @param useCache useCache
- * @return instance.
+ * @since 1.0.5
+ * @param type type
+ * @param expectType expect java type.
+ * @param useCache useCache
+ * @return instance.
*/
- T create(String type, boolean useCache);
+ T create(String type, Class expectType, boolean useCache);
}
diff --git a/smart-flow-helper/src/main/java/org/smartboot/flow/helper/mock/FakeAdapter.java b/smart-flow-helper/src/main/java/org/smartboot/flow/helper/mock/FakeAdapter.java
new file mode 100644
index 0000000..a127e0b
--- /dev/null
+++ b/smart-flow-helper/src/main/java/org/smartboot/flow/helper/mock/FakeAdapter.java
@@ -0,0 +1,36 @@
+package org.smartboot.flow.helper.mock;
+
+import org.smartboot.flow.core.Adapter;
+import org.smartboot.flow.core.EngineContext;
+import org.smartboot.flow.core.common.Pair;
+
+/**
+ * Fake Class, do-nothing
+ *
+ * @author qinluo
+ * @date 2023/1/27 12:35
+ * @since 1.0.0
+ */
+public class FakeAdapter implements Adapter