void copy(EngineContext
dest) {
// Reuse extensions.
dest.extensions = this.extensions;
@@ -297,6 +321,8 @@ public class EngineContext P getExt(Key key) {
Value value = extensions.get(key);
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 e6daf28..263267a 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
@@ -26,16 +26,32 @@ public class AttributeValueResolver {
this.objectCreator = objectCreator;
}
+ public void setObjectCreator(ObjectCreator objectCreator) {
+ this.objectCreator = objectCreator;
+ }
+
+ public ObjectCreator getObjectCreator() {
+ return objectCreator;
+ }
+
public static AttributeValueResolver getInstance() {
return INSTANCE;
}
+ protected Object earlyResolve(String value) {
+ return value;
+ }
+
public Object resolve(Class> accepted, Object value) {
if (value == null) {
return null;
}
- if (accepted.isInstance(value)) {
+ if (value instanceof String) {
+ value = earlyResolve((String)value);
+ }
+
+ if (accepted.isInstance(value) && accepted != Object.class) {
return value;
}
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 ca3007e..cf4ec14 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
@@ -35,6 +35,7 @@ import org.smartboot.flow.core.script.ScriptExecutable;
import org.smartboot.flow.core.script.ScriptExecutor;
import org.smartboot.flow.core.util.AssertUtil;
import org.smartboot.flow.core.util.AuxiliaryUtils;
+import org.smartboot.flow.core.util.ReflectionUtils;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
@@ -53,6 +54,7 @@ import java.util.stream.Collectors;
public class BuilderDefinitionVisitor implements DefinitionVisitor {
private static final Logger LOGGER = LoggerFactory.getLogger(BuilderDefinitionVisitor.class);
+ private static final String SETTER_PREFIX = "set";
private final MapExtensionAttrParser has same prefixed-attribute.
--
Gitee
From a05611ebb0e0417d67a25b0b5f3b24f6593146d7 Mon Sep 17 00:00:00 2001
From: qinluo <1558642210@qq.com>
Date: Sat, 17 Jun 2023 12:08:53 +0800
Subject: [PATCH 06/22] =?UTF-8?q?qinluo:=20=20=20=20=20=20-=20xml=E8=A7=A3?=
=?UTF-8?q?=E6=9E=90=E9=87=8D=E6=9E=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../flow/admin/g6/G6ResultSerializer.java | 2 +-
.../core/executable/DecorateExecutable.java | 61 +++++++++++++
.../core/parser/AbstractElementParser.java | 20 ++---
.../core/parser/AdapterElementParser.java | 14 ++-
.../core/parser/BuilderDefinitionVisitor.java | 46 +++++-----
.../flow/core/parser/ChooseElementParser.java | 44 +++++----
.../core/parser/ComponentElementParser.java | 5 +-
.../flow/core/parser/DefaultParser.java | 4 +-
.../flow/core/parser/DefinitionVisitor.java | 60 ++++++++++---
.../flow/core/parser/ElementUtils.java | 7 ++
.../flow/core/parser/EngineElementParser.java | 1 -
.../flow/core/parser/ExtensionAttrParser.java | 1 -
.../flow/core/parser/IfElementParser.java | 33 ++++---
.../flow/core/parser/ParseConstants.java | 5 ++
.../flow/core/parser/ParserContext.java | 12 +--
.../core/parser/PipelineElementParser.java | 6 +-
.../flow/core/parser/ScriptElementParser.java | 2 +-
.../flow/core/parser/ScriptLoader.java | 6 +-
.../flow/core/parser/ScriptLoaderParser.java | 2 +-
.../flow/core/parser/ThreadPoolCreator.java | 2 +-
.../parser/definition/AdapterDefinition.java | 8 +-
.../parser/definition/ChooseDefinition.java | 36 ++++----
.../definition/ComponentDefinition.java | 28 ++++++
.../definition/ConditionDefinition.java | 19 ++++
.../parser/definition/ElementDefinition.java | 90 +------------------
.../parser/definition/EngineDefinition.java | 5 +-
.../parser/definition/FlowDefinition.java | 68 ++++++++++++++
.../definition/IfElementDefinition.java | 16 ++--
.../PipelineComponentDefinition.java | 2 +-
.../parser/definition/PipelineDefinition.java | 10 +--
.../parser/definition/ScriptDefinition.java | 4 +-
.../flow/core/visitor/ExecutableVisitor.java | 14 +++
.../src/main/resources/smart-flow-1.0.1.xsd | 6 +-
.../flow/helper/view/XmlEngineVisitor.java | 2 +-
.../extension/BeanDefinitionVisitor.java | 85 +++++++++---------
35 files changed, 439 insertions(+), 287 deletions(-)
create mode 100644 smart-flow-core/src/main/java/org/smartboot/flow/core/executable/DecorateExecutable.java
create mode 100644 smart-flow-core/src/main/java/org/smartboot/flow/core/parser/definition/ComponentDefinition.java
create mode 100644 smart-flow-core/src/main/java/org/smartboot/flow/core/parser/definition/ConditionDefinition.java
create mode 100644 smart-flow-core/src/main/java/org/smartboot/flow/core/parser/definition/FlowDefinition.java
diff --git a/smart-flow-admin/src/main/java/org/smartboot/smart/flow/admin/g6/G6ResultSerializer.java b/smart-flow-admin/src/main/java/org/smartboot/smart/flow/admin/g6/G6ResultSerializer.java
index 6e28e2b..c6c26e5 100644
--- a/smart-flow-admin/src/main/java/org/smartboot/smart/flow/admin/g6/G6ResultSerializer.java
+++ b/smart-flow-admin/src/main/java/org/smartboot/smart/flow/admin/g6/G6ResultSerializer.java
@@ -69,7 +69,7 @@ public class G6ResultSerializer {
if (scripts != null && scripts.size() > 0) {
scripts.forEach((k, v) -> content.append("\n\t\n"));
+ .append("\">").append("").append("\n"));
}
content.append("\n").append(END).append("\n");
diff --git a/smart-flow-core/src/main/java/org/smartboot/flow/core/executable/DecorateExecutable.java b/smart-flow-core/src/main/java/org/smartboot/flow/core/executable/DecorateExecutable.java
new file mode 100644
index 0000000..2cbc567
--- /dev/null
+++ b/smart-flow-core/src/main/java/org/smartboot/flow/core/executable/DecorateExecutable.java
@@ -0,0 +1,61 @@
+package org.smartboot.flow.core.executable;
+
+
+import org.smartboot.flow.core.EngineContext;
+import org.smartboot.flow.core.visitor.ExecutableVisitor;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Executable decorate class.
+ *
+ * @author qinluo
+ * @date 2022-11-12 21:29:01
+ * @since 1.1.0
+ */
+public final class DecorateExecutable
*
diff --git a/smart-flow-core/src/main/java/org/smartboot/flow/core/parser/ExtensionAttrParser.java b/smart-flow-core/src/main/java/org/smartboot/flow/core/parser/ExtensionAttrParser.java
index b310606..c514876 100644
--- a/smart-flow-core/src/main/java/org/smartboot/flow/core/parser/ExtensionAttrParser.java
+++ b/smart-flow-core/src/main/java/org/smartboot/flow/core/parser/ExtensionAttrParser.java
@@ -11,7 +11,6 @@ public interface ExtensionAttrParser {
/**
* Returns extension attribute prefix.
- *
* for example: prefix = preexecute
*
* {@code
diff --git a/smart-flow-core/src/main/java/org/smartboot/flow/core/parser/IfElementParser.java b/smart-flow-core/src/main/java/org/smartboot/flow/core/parser/IfElementParser.java
index 4bd4a8e..f3c539e 100644
--- a/smart-flow-core/src/main/java/org/smartboot/flow/core/parser/IfElementParser.java
+++ b/smart-flow-core/src/main/java/org/smartboot/flow/core/parser/IfElementParser.java
@@ -1,5 +1,6 @@
package org.smartboot.flow.core.parser;
+import org.smartboot.flow.core.parser.definition.ComponentDefinition;
import org.smartboot.flow.core.parser.definition.ElementDefinition;
import org.smartboot.flow.core.parser.definition.IfElementDefinition;
import org.smartboot.flow.core.util.AssertUtil;
@@ -35,37 +36,33 @@ public class IfElementParser extends AbstractElementParser {
AssertUtil.notBlank(test, "attribute [test] cannot be null");
IfElementDefinition ifDef = new IfElementDefinition();
- ElementDefinition.build(ifDef, element);
-
ifDef.setIdentifier(super.getIdentifier(element, context));
- ifDef.setTest(element.getAttribute(ParseConstants.TEST));
+ ifDef.setTest(test);
+ ElementUtils.build(ifDef, element);
List
* execute.
+ *
+ * @since 1.1.0
+ * @param attrs binding attributes.
+ */
+ public void visitBindingAttrs(Map