This is an automated email from the ASF dual-hosted git repository.
veithen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ws-axiom.git
The following commit(s) were added to refs/heads/master by this push:
new 0fa11ccdc Extract DOMClonePolicy abstract base class from DOMSemantics
0fa11ccdc is described below
commit 0fa11ccdc2dab54fe9157b89f1e4260be99a092b
Author: Copilot <[email protected]>
AuthorDate: Sun May 24 11:11:12 2026 +0100
Extract DOMClonePolicy abstract base class from DOMSemantics
Co-authored-by: Andreas Veithen-Knowles <[email protected]>
---
.../java/org/apache/axiom/dom/DOMClonePolicy.java | 49 ++++++++++++++++++++++
.../java/org/apache/axiom/dom/DOMSemantics.java | 46 +-------------------
2 files changed, 51 insertions(+), 44 deletions(-)
diff --git
a/mixins/dom-mixins/src/main/java/org/apache/axiom/dom/DOMClonePolicy.java
b/mixins/dom-mixins/src/main/java/org/apache/axiom/dom/DOMClonePolicy.java
new file mode 100644
index 000000000..38273938b
--- /dev/null
+++ b/mixins/dom-mixins/src/main/java/org/apache/axiom/dom/DOMClonePolicy.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axiom.dom;
+
+import org.apache.axiom.core.ClonePolicy;
+import org.apache.axiom.core.CoreNode;
+import org.apache.axiom.core.NodeFactory;
+import org.apache.axiom.core.NodeType;
+
+abstract class DOMClonePolicy implements ClonePolicy<Void> {
+ @Override
+ public CoreNode createTargetNode(Void options, CoreNode node, NodeFactory
factory) {
+ // This is not specified by the API, but it's compatible with versions
before
+ // 1.2.14
+ return factory.createNode(node.coreGetNodeClass());
+ }
+
+ @Override
+ public boolean repairNamespaces(Void options) {
+ return false;
+ }
+
+ @Override
+ public boolean cloneAttributes(Void options) {
+ return true;
+ }
+
+ @Override
+ public abstract boolean cloneChildren(Void options, NodeType nodeType);
+
+ @Override
+ public void postProcess(Void options, CoreNode clone) {}
+}
diff --git
a/mixins/dom-mixins/src/main/java/org/apache/axiom/dom/DOMSemantics.java
b/mixins/dom-mixins/src/main/java/org/apache/axiom/dom/DOMSemantics.java
index 9077f2a82..e17d824d2 100644
--- a/mixins/dom-mixins/src/main/java/org/apache/axiom/dom/DOMSemantics.java
+++ b/mixins/dom-mixins/src/main/java/org/apache/axiom/dom/DOMSemantics.java
@@ -25,11 +25,9 @@ import org.apache.axiom.core.ClonePolicy;
import org.apache.axiom.core.CoreAttribute;
import org.apache.axiom.core.CoreModelException;
import org.apache.axiom.core.CoreNSUnawareAttribute;
-import org.apache.axiom.core.CoreNode;
import org.apache.axiom.core.DetachPolicy;
import org.apache.axiom.core.NSAwareAttributeMatcher;
import org.apache.axiom.core.NamespaceDeclarationMatcher;
-import org.apache.axiom.core.NodeFactory;
import org.apache.axiom.core.NodeFactory2;
import org.apache.axiom.core.NodeType;
import org.apache.axiom.core.Semantics;
@@ -114,58 +112,18 @@ public final class DOMSemantics implements Semantics {
public static final AttributeMatcher NAMESPACE_DECLARATION_MATCHER = new
NamespaceDeclarationMatcher(INSTANCE);
- public static final ClonePolicy<Void> DEEP_CLONE = new ClonePolicy<Void>()
{
- @Override
- public CoreNode createTargetNode(Void options, CoreNode node,
NodeFactory factory) {
- // This is not specified by the API, but it's compatible with
versions before
- // 1.2.14
- return factory.createNode(node.coreGetNodeClass());
- }
-
- @Override
- public boolean repairNamespaces(Void options) {
- return false;
- }
-
- @Override
- public boolean cloneAttributes(Void options) {
- return true;
- }
-
+ public static final ClonePolicy<Void> DEEP_CLONE = new DOMClonePolicy() {
@Override
public boolean cloneChildren(Void options, NodeType nodeType) {
return true;
}
-
- @Override
- public void postProcess(Void options, CoreNode clone) {}
};
- public static final ClonePolicy<Void> SHALLOW_CLONE = new
ClonePolicy<Void>() {
- @Override
- public CoreNode createTargetNode(Void options, CoreNode node,
NodeFactory factory) {
- // This is not specified by the API, but it's compatible with
versions before
- // 1.2.14
- return factory.createNode(node.coreGetNodeClass());
- }
-
- @Override
- public boolean repairNamespaces(Void options) {
- return false;
- }
-
- @Override
- public boolean cloneAttributes(Void options) {
- return true;
- }
-
+ public static final ClonePolicy<Void> SHALLOW_CLONE = new DOMClonePolicy()
{
@Override
public boolean cloneChildren(Void options, NodeType nodeType) {
return nodeType == NodeType.NS_UNAWARE_ATTRIBUTE || nodeType ==
NodeType.NS_AWARE_ATTRIBUTE;
}
-
- @Override
- public void postProcess(Void options, CoreNode clone) {}
};
@Override