You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2015/10/01 09:11:34 UTC
svn commit: r1706187 - in /webservices/axiom/trunk/aspects:
core-aspects/src/main/java/org/apache/axiom/core/
dom-aspects/src/main/java/org/apache/axiom/dom/
om-aspects/src/main/java/org/apache/axiom/om/impl/common/
Author: veithen
Date: Thu Oct 1 07:11:33 2015
New Revision: 1706187
URL: http://svn.apache.org/viewvc?rev=1706187&view=rev
Log:
Use DetachPolicy for coreSetAttribute.
Modified:
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreElement.java
webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreElementSupport.aj
webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMElementSupport.aj
webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomElementSupport.aj
Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreElement.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreElement.java?rev=1706187&r1=1706186&r2=1706187&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreElement.java (original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreElement.java Thu Oct 1 07:11:33 2015
@@ -86,18 +86,12 @@ public interface CoreElement extends Cor
* the {@link AttributeMatcher} implementation to use
* @param attr
* the new attribute to add
- * @param changeDocumentOfReplacedAttribute
- * specifies if the owner document of the replaced attribute (if any) should be
- * changed
- * @param newDocument
- * the new owner document for the replaced attribute, or <code>null</code> if the
- * attribute will have its own owner document (which may be created lazily at a later
- * moment); only meaningful if <code>changeDocumentOfReplacedAttribute</code> is
- * <code>true</code
+ * @param detachPolicy
+ * determines the new owner document for the replaced attribute
* @return the attribute that was replaced by the new attribute, or <code>null</code> if no
* matching attribute existed.
*/
- CoreAttribute coreSetAttribute(AttributeMatcher matcher, CoreAttribute attr, boolean changeDocumentOfReplacedAttribute, CoreDocument newDocument);
+ CoreAttribute coreSetAttribute(AttributeMatcher matcher, CoreAttribute attr, DetachPolicy detachPolicy);
/**
* Append an attribute to this element. The attribute is simply added at the end of the list of
Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreElementSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreElementSupport.aj?rev=1706187&r1=1706186&r2=1706187&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreElementSupport.aj (original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreElementSupport.aj Thu Oct 1 07:11:33 2015
@@ -91,7 +91,7 @@ public aspect CoreElementSupport {
}
}
- public final CoreAttribute CoreElement.coreSetAttribute(AttributeMatcher matcher, CoreAttribute attr, boolean changeDocumentOfReplacedAttribute, CoreDocument newDocument) {
+ public final CoreAttribute CoreElement.coreSetAttribute(AttributeMatcher matcher, CoreAttribute attr, DetachPolicy detachPolicy) {
if (attr.coreGetOwnerElement() == this) {
// TODO: document this and add assertion
return attr;
@@ -118,7 +118,7 @@ public aspect CoreElementSupport {
} else {
previousAttr.internalSetNextAttribute(attr);
}
- existingAttr.internalUnsetOwnerElement(changeDocumentOfReplacedAttribute ? newDocument : coreGetOwnerDocument(true));
+ existingAttr.internalUnsetOwnerElement(detachPolicy.getNewOwnerDocument(this));
attr.internalSetNextAttribute(existingAttr.coreGetNextAttribute());
existingAttr.internalSetNextAttribute(null);
}
Modified: webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMElementSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMElementSupport.aj?rev=1706187&r1=1706186&r2=1706187&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMElementSupport.aj (original)
+++ webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/DOMElementSupport.aj Thu Oct 1 07:11:33 2015
@@ -159,7 +159,7 @@ public aspect DOMElementSupport {
// Must be a DOM1 (namespace unaware) attribute
matcher = Policies.DOM1_ATTRIBUTE_MATCHER;
}
- return (DOMAttribute)coreSetAttribute(matcher, newAttr, false, null);
+ return (DOMAttribute)coreSetAttribute(matcher, newAttr, Policies.DETACH_POLICY);
}
}
Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomElementSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomElementSupport.aj?rev=1706187&r1=1706186&r2=1706187&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomElementSupport.aj (original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/common/AxiomElementSupport.aj Thu Oct 1 07:11:33 2015
@@ -278,7 +278,7 @@ public aspect AxiomElementSupport {
}
public final void AxiomElement.internalAppendAttribute(OMAttribute attr) {
- coreSetAttribute(Policies.ATTRIBUTE_MATCHER, (AxiomAttribute)attr, true, null);
+ coreSetAttribute(Policies.ATTRIBUTE_MATCHER, (AxiomAttribute)attr, Policies.DETACH_POLICY);
}
public final OMAttribute AxiomElement.addAttribute(OMAttribute attr){
@@ -356,7 +356,7 @@ public aspect AxiomElementSupport {
public final void AxiomElement.addNamespaceDeclaration(OMNamespace ns) {
AxiomNamespaceDeclaration decl = coreGetNodeFactory().createNode(AxiomNamespaceDeclaration.class);
decl.setDeclaredNamespace(ns);
- coreSetAttribute(Policies.NAMESPACE_DECLARATION_MATCHER, decl, true, null);
+ coreSetAttribute(Policies.NAMESPACE_DECLARATION_MATCHER, decl, Policies.DETACH_POLICY);
}
@SuppressWarnings("rawtypes")