ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1735002 - in /webservices/axiom/trunk: aspects/core-aspects/src/main/java/org/apache/axiom/core/ aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/ aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/ aspects/do...
Date Mon, 14 Mar 2016 23:30:53 GMT
Author: veithen
Date: Mon Mar 14 23:30:52 2016
New Revision: 1735002

URL: http://svn.apache.org/viewvc?rev=1735002&view=rev
Log:
Simplify the node mapping code.

Added:
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/Mappers.java
  (with props)
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/CoreParentNode.java
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/IdentityMapper.java
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/AttributeIterator.java
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/NodesIterator.java
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreElementSupport.aj
    webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreParentNodeSupport.aj
    webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/ElementsByTagName.java
    webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/ElementsByTagNameNS.java
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomContainerSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomElementSupport.aj
    webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMElement.java

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=1735002&r1=1735001&r2=1735002&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
Mon Mar 14 23:30:52 2016
@@ -119,7 +119,7 @@ public interface CoreElement extends Cor
      */
     boolean coreRemoveAttribute(AttributeMatcher matcher, String namespaceURI, String name,
Semantics semantics);
     
-    <T extends CoreAttribute,S> Iterator<S> coreGetAttributesByType(Class<T>
type, Mapper<S,T> mapper, Semantics semantics);
+    <T extends CoreAttribute,S> Iterator<S> coreGetAttributesByType(Class<T>
type, Mapper<S,? super T> mapper, Semantics semantics);
     
     /**
      * Look up the namespace URI associated to the given prefix.

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreParentNode.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreParentNode.java?rev=1735002&r1=1735001&r2=1735002&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreParentNode.java
(original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/CoreParentNode.java
Mon Mar 14 23:30:52 2016
@@ -46,7 +46,7 @@ public interface CoreParentNode extends
     void coreSetState(int state);
     void coreBuild() throws CoreModelException;
 
-    <T> NodeIterator<T> coreGetNodes(Axis axis, Mapper<T,? super CoreNode>
mapper, Semantics semantics);
+    <T extends CoreNode,S> NodeIterator<S> coreGetNodes(Axis axis, Class<T>
type, Mapper<S,? super T> mapper, Semantics semantics);
 
     <T extends CoreElement,S> NodeIterator<S> coreGetElements(Axis axis, Class<T>
type, ElementMatcher<? super T> matcher, String namespaceURI, String name, Mapper<S,?
super T> mapper, Semantics semantics);
 }

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/IdentityMapper.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/IdentityMapper.java?rev=1735002&r1=1735001&r2=1735002&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/IdentityMapper.java
(original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/IdentityMapper.java
Mon Mar 14 23:30:52 2016
@@ -18,7 +18,7 @@
  */
 package org.apache.axiom.core;
 
-public final class IdentityMapper<S,T extends S> implements Mapper<S,T> {
+final class IdentityMapper<S,T extends S> implements Mapper<S,T> {
     public S map(T object) {
         return object;
     }

Added: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/Mappers.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/Mappers.java?rev=1735002&view=auto
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/Mappers.java
(added)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/Mappers.java
Mon Mar 14 23:30:52 2016
@@ -0,0 +1,37 @@
+/*
+ * 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.core;
+
+public final class Mappers {
+    @SuppressWarnings("rawtypes")
+    private static final IdentityMapper IDENTITY = new IdentityMapper();
+    
+    private Mappers() {}
+    
+    @SuppressWarnings("unchecked")
+    public static <S,T extends S> Mapper<S,T> upcast() {
+        // This is an optimization for the following type safe instruction:
+        // return new IdentityMapper<S,T>();
+        return IDENTITY;
+    }
+    
+    public static <T> Mapper<T,T> identity() {
+        return upcast();
+    }
+}

Propchange: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/Mappers.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/AttributeIterator.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/AttributeIterator.java?rev=1735002&r1=1735001&r2=1735002&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/AttributeIterator.java
(original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/AttributeIterator.java
Mon Mar 14 23:30:52 2016
@@ -29,13 +29,13 @@ import org.apache.axiom.core.Semantics;
 
 public final class AttributeIterator<T extends CoreAttribute,S> implements Iterator<S>
{
     private final Class<T> type;
-    private final Mapper<S,T> mapper;
+    private final Mapper<S,? super T> mapper;
     private final Semantics semantics;
     private CoreAttribute currentAttribute;
     private CoreAttribute nextAttribute;
     private boolean nextAttributeSet;
     
-    private AttributeIterator(CoreAttribute firstAttribute, Class<T> type, Mapper<S,T>
mapper, Semantics semantics) {
+    private AttributeIterator(CoreAttribute firstAttribute, Class<T> type, Mapper<S,?
super T> mapper, Semantics semantics) {
         this.type = type;
         this.mapper = mapper;
         this.semantics = semantics;
@@ -43,7 +43,7 @@ public final class AttributeIterator<T e
         nextAttributeSet = true;
     }
     
-    public static <T extends CoreAttribute,S> Iterator<S> create(CoreElement
element, Class<T> type, Mapper<S,T> mapper, Semantics semantics) {
+    public static <T extends CoreAttribute,S> Iterator<S> create(CoreElement
element, Class<T> type, Mapper<S,? super T> mapper, Semantics semantics) {
         CoreAttribute attribute = element.coreGetFirstAttribute();
         while (attribute != null && !type.isInstance(attribute)) {
             attribute = attribute.coreGetNextAttribute();

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/NodesIterator.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/NodesIterator.java?rev=1735002&r1=1735001&r2=1735002&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/NodesIterator.java
(original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/NodesIterator.java
Mon Mar 14 23:30:52 2016
@@ -25,10 +25,10 @@ import org.apache.axiom.core.CoreParentN
 import org.apache.axiom.core.Mapper;
 import org.apache.axiom.core.Semantics;
 
-public final class NodesIterator<S> extends AbstractNodeIterator<CoreNode,S>
{
-    public NodesIterator(CoreParentNode startNode, Axis axis,
-            Mapper<S,? super CoreNode> mapper, Semantics semantics) {
-        super(startNode, axis, CoreNode.class, mapper, semantics);
+public final class NodesIterator<T extends CoreNode,S> extends AbstractNodeIterator<T,S>
{
+    public NodesIterator(CoreParentNode startNode, Axis axis, Class<T> type,
+            Mapper<S,? super T> mapper, Semantics semantics) {
+        super(startNode, axis, type, mapper, semantics);
     }
 
     @Override

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreElementSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreElementSupport.aj?rev=1735002&r1=1735001&r2=1735002&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreElementSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreElementSupport.aj
Mon Mar 14 23:30:52 2016
@@ -134,7 +134,7 @@ public aspect CoreElementSupport {
         }
     }
 
-    public final <T extends CoreAttribute,S> Iterator<S> CoreElement.coreGetAttributesByType(Class<T>
type, Mapper<S,T> mapper, Semantics semantics) {
+    public final <T extends CoreAttribute,S> Iterator<S> CoreElement.coreGetAttributesByType(Class<T>
type, Mapper<S,? super T> mapper, Semantics semantics) {
         return AttributeIterator.create(this, type, mapper, semantics);
     }
 

Modified: webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreParentNodeSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreParentNodeSupport.aj?rev=1735002&r1=1735001&r2=1735002&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreParentNodeSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/core-aspects/src/main/java/org/apache/axiom/core/impl/mixin/CoreParentNodeSupport.aj
Mon Mar 14 23:30:52 2016
@@ -362,8 +362,8 @@ public aspect CoreParentNodeSupport {
         }
     }
     
-    public final <T> NodeIterator<T> CoreParentNode.coreGetNodes(Axis axis, Mapper<T,?
super CoreNode> mapper, Semantics semantics) {
-        return new NodesIterator<T>(this, axis, mapper, semantics);
+    public final <T extends CoreNode,S> NodeIterator<S> CoreParentNode.coreGetNodes(Axis
axis, Class<T> type, Mapper<S,? super T> mapper, Semantics semantics) {
+        return new NodesIterator<T,S>(this, axis, type, mapper, semantics);
     }
     
     public final <T extends CoreElement,S> NodeIterator<S> CoreParentNode.coreGetElements(Axis
axis, Class<T> type, ElementMatcher<? super T> matcher, String namespaceURI, String
name, Mapper<S,? super T> mapper, Semantics semantics) {

Modified: webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/ElementsByTagName.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/ElementsByTagName.java?rev=1735002&r1=1735001&r2=1735002&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/ElementsByTagName.java
(original)
+++ webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/ElementsByTagName.java
Mon Mar 14 23:30:52 2016
@@ -21,12 +21,11 @@ package org.apache.axiom.dom;
 import java.util.Iterator;
 
 import org.apache.axiom.core.Axis;
-import org.apache.axiom.core.CoreElement;
 import org.apache.axiom.core.ElementMatcher;
-import org.apache.axiom.core.Mapper;
+import org.apache.axiom.core.Mappers;
 import org.w3c.dom.Node;
 
-public class ElementsByTagName extends NodeListImpl implements Mapper<Node,CoreElement>
{
+public class ElementsByTagName extends NodeListImpl {
     private final DOMParentNode node;
     private final String tagname;
     
@@ -38,13 +37,9 @@ public class ElementsByTagName extends N
     @Override
     protected Iterator<? extends Node> createIterator() {
         if (tagname.equals("*")) {
-            return node.coreGetElements(Axis.DESCENDANTS, CoreElement.class, ElementMatcher.ANY,
null, null, this, DOMSemantics.INSTANCE);
+            return node.coreGetElements(Axis.DESCENDANTS, DOMElement.class, ElementMatcher.ANY,
null, null, Mappers.<Node>identity(), DOMSemantics.INSTANCE);
         } else {
-            return node.coreGetElements(Axis.DESCENDANTS, CoreElement.class, ElementMatcher.BY_NAME,
null, tagname, this, DOMSemantics.INSTANCE);
+            return node.coreGetElements(Axis.DESCENDANTS, DOMElement.class, ElementMatcher.BY_NAME,
null, tagname, Mappers.<Node>identity(), DOMSemantics.INSTANCE);
         }
     }
-
-    public Node map(CoreElement element) {
-        return (Node)element;
-    }
 }

Modified: webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/ElementsByTagNameNS.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/ElementsByTagNameNS.java?rev=1735002&r1=1735001&r2=1735002&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/ElementsByTagNameNS.java
(original)
+++ webservices/axiom/trunk/aspects/dom-aspects/src/main/java/org/apache/axiom/dom/ElementsByTagNameNS.java
Mon Mar 14 23:30:52 2016
@@ -21,13 +21,11 @@ package org.apache.axiom.dom;
 import java.util.Iterator;
 
 import org.apache.axiom.core.Axis;
-import org.apache.axiom.core.CoreElement;
-import org.apache.axiom.core.CoreNSAwareElement;
 import org.apache.axiom.core.ElementMatcher;
-import org.apache.axiom.core.Mapper;
+import org.apache.axiom.core.Mappers;
 import org.w3c.dom.Node;
 
-public class ElementsByTagNameNS extends NodeListImpl implements Mapper<Node,CoreElement>
{
+public class ElementsByTagNameNS extends NodeListImpl {
     private final DOMParentNode node;
     private final String namespaceURI;
     private final String localName;
@@ -44,17 +42,13 @@ public class ElementsByTagNameNS extends
         boolean localNameWildcard = localName.equals("*");
         if (nsWildcard && localNameWildcard) {
             // TODO: there seems to be no unit test checking whether the iterator should
return DOM1 elements!
-            return node.coreGetElements(Axis.DESCENDANTS, CoreElement.class, ElementMatcher.ANY,
null, null, this, DOMSemantics.INSTANCE);
+            return node.coreGetElements(Axis.DESCENDANTS, DOMElement.class, ElementMatcher.ANY,
null, null, Mappers.<Node>identity(), DOMSemantics.INSTANCE);
         } else if (nsWildcard) {
-            return node.coreGetElements(Axis.DESCENDANTS, CoreNSAwareElement.class, ElementMatcher.BY_LOCAL_NAME,
null, localName, this, DOMSemantics.INSTANCE);
+            return node.coreGetElements(Axis.DESCENDANTS, DOMNSAwareElement.class, ElementMatcher.BY_LOCAL_NAME,
null, localName, Mappers.<Node>identity(), DOMSemantics.INSTANCE);
         } else if (localNameWildcard) {
-            return node.coreGetElements(Axis.DESCENDANTS, CoreNSAwareElement.class, ElementMatcher.BY_NAMESPACE_URI,
namespaceURI, null, this, DOMSemantics.INSTANCE);
+            return node.coreGetElements(Axis.DESCENDANTS, DOMNSAwareElement.class, ElementMatcher.BY_NAMESPACE_URI,
namespaceURI, null, Mappers.<Node>identity(), DOMSemantics.INSTANCE);
         } else {
-            return node.coreGetElements(Axis.DESCENDANTS, CoreNSAwareElement.class, ElementMatcher.BY_QNAME,
namespaceURI, localName, this, DOMSemantics.INSTANCE);
+            return node.coreGetElements(Axis.DESCENDANTS, DOMNSAwareElement.class, ElementMatcher.BY_QNAME,
namespaceURI, localName, Mappers.<Node>identity(), DOMSemantics.INSTANCE);
         }
     }
-
-    public Node map(CoreElement element) {
-        return (Node)element;
-    }
 }

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomContainerSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomContainerSupport.aj?rev=1735002&r1=1735001&r2=1735002&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomContainerSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomContainerSupport.aj
Mon Mar 14 23:30:52 2016
@@ -33,10 +33,8 @@ import org.apache.axiom.core.Axis;
 import org.apache.axiom.core.Builder;
 import org.apache.axiom.core.CoreElement;
 import org.apache.axiom.core.CoreModelException;
-import org.apache.axiom.core.CoreNSAwareElement;
-import org.apache.axiom.core.CoreNode;
 import org.apache.axiom.core.ElementMatcher;
-import org.apache.axiom.core.Mapper;
+import org.apache.axiom.core.Mappers;
 import org.apache.axiom.core.stream.NamespaceRepairingFilterHandler;
 import org.apache.axiom.core.stream.NamespaceURIInterningFilterHandler;
 import org.apache.axiom.core.stream.StreamException;
@@ -64,6 +62,8 @@ import org.apache.axiom.om.impl.common.s
 import org.apache.axiom.om.impl.common.serializer.push.stax.StAXSerializer;
 import org.apache.axiom.om.impl.intf.AxiomChildNode;
 import org.apache.axiom.om.impl.intf.AxiomContainer;
+import org.apache.axiom.om.impl.intf.AxiomElement;
+import org.apache.axiom.om.impl.intf.AxiomSerializable;
 import org.apache.axiom.om.impl.intf.OMFactoryEx;
 import org.apache.axiom.om.impl.stream.stax.AxiomXMLStreamReaderExtensionFactory;
 import org.apache.axiom.om.util.StAXUtils;
@@ -162,32 +162,20 @@ public aspect AxiomContainerSupport {
         }
     }
     
-    private static final Mapper<OMNode,CoreNode> childrenMapper = new Mapper<OMNode,CoreNode>()
{
-        public OMNode map(CoreNode node) {
-            return (OMNode)node;
-        }
-    };
-    
     public Iterator<OMNode> AxiomContainer.getChildren() {
-        return coreGetNodes(Axis.CHILDREN, childrenMapper, AxiomSemantics.INSTANCE);
+        return coreGetNodes(Axis.CHILDREN, AxiomChildNode.class, Mappers.<OMNode>identity(),
AxiomSemantics.INSTANCE);
     }
 
-    private static final Mapper<OMElement,CoreNSAwareElement> childElementMapper =
new Mapper<OMElement,CoreNSAwareElement>() {
-        public OMElement map(CoreNSAwareElement element) {
-            return (OMElement)element;
-        }
-    };
-    
     public Iterator<OMElement> AxiomContainer.getChildrenWithLocalName(String localName)
{
-        return coreGetElements(Axis.CHILDREN, CoreNSAwareElement.class,
+        return coreGetElements(Axis.CHILDREN, AxiomElement.class,
                 ElementMatcher.BY_LOCAL_NAME, null, localName,
-                childElementMapper, AxiomSemantics.INSTANCE);
+                Mappers.<OMElement>identity(), AxiomSemantics.INSTANCE);
     }
 
     public Iterator<OMElement> AxiomContainer.getChildrenWithNamespaceURI(String uri)
{
-        return coreGetElements(Axis.CHILDREN, CoreNSAwareElement.class,
+        return coreGetElements(Axis.CHILDREN, AxiomElement.class,
                 ElementMatcher.BY_NAMESPACE_URI, uri, null,
-                childElementMapper, AxiomSemantics.INSTANCE);
+                Mappers.<OMElement>identity(), AxiomSemantics.INSTANCE);
     }
 
     // TODO: DOOM actually supported elementQName == null; need to test and document this
@@ -195,14 +183,8 @@ public aspect AxiomContainerSupport {
         return new OMChildrenQNameIterator(getFirstOMChild(), elementQName);
     }
     
-    private static final Mapper<OMSerializable,CoreNode> descendantsMapper = new Mapper<OMSerializable,CoreNode>()
{
-        public OMSerializable map(CoreNode node) {
-            return (OMSerializable)node;
-        }
-    };
-    
     public Iterator<OMSerializable> AxiomContainer.getDescendants(boolean includeSelf)
{
-        return coreGetNodes(includeSelf ? Axis.DESCENDANTS_OR_SELF : Axis.DESCENDANTS, descendantsMapper,
AxiomSemantics.INSTANCE);
+        return coreGetNodes(includeSelf ? Axis.DESCENDANTS_OR_SELF : Axis.DESCENDANTS, AxiomSerializable.class,
Mappers.<OMSerializable>identity(), AxiomSemantics.INSTANCE);
     }
 
     public OMElement AxiomContainer.getFirstChildWithName(QName elementQName) throws OMException
{

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomElementSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomElementSupport.aj?rev=1735002&r1=1735001&r2=1735002&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomElementSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomElementSupport.aj
Mon Mar 14 23:30:52 2016
@@ -42,8 +42,7 @@ import org.apache.axiom.core.CoreModelEx
 import org.apache.axiom.core.CoreParentNode;
 import org.apache.axiom.core.ElementAction;
 import org.apache.axiom.core.ElementMatcher;
-import org.apache.axiom.core.IdentityMapper;
-import org.apache.axiom.core.Mapper;
+import org.apache.axiom.core.Mappers;
 import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.OMConstants;
 import org.apache.axiom.om.OMContainer;
@@ -112,15 +111,9 @@ public aspect AxiomElementSupport {
         return null;
     }
 
-    private static final Mapper<OMElement,CoreElement> childElementMapper = new Mapper<OMElement,CoreElement>()
{
-        public OMElement map(CoreElement element) {
-            return (OMElement)element;
-        }
-    };
-    
     public final Iterator<OMElement> AxiomElement.getChildElements() {
-        return coreGetElements(Axis.CHILDREN, CoreElement.class, ElementMatcher.ANY, null,
null,
-                childElementMapper, AxiomSemantics.INSTANCE);
+        return coreGetElements(Axis.CHILDREN, AxiomElement.class, ElementMatcher.ANY, null,
null,
+                Mappers.<OMElement>identity(), AxiomSemantics.INSTANCE);
     }
 
     public final Iterator<OMNamespace> AxiomElement.getNamespacesInScope() {
@@ -346,10 +339,8 @@ public aspect AxiomElementSupport {
         return addAttribute(getOMFactory().createOMAttribute(localName, namespace, value));
     }
 
-    private static final Mapper<OMAttribute,AxiomAttribute> attributeMapper = new IdentityMapper<OMAttribute,AxiomAttribute>();
-    
     public final Iterator<OMAttribute> AxiomElement.getAllAttributes() {
-        return coreGetAttributesByType(AxiomAttribute.class, attributeMapper, AxiomSemantics.INSTANCE);
+        return coreGetAttributesByType(AxiomAttribute.class, Mappers.<OMAttribute>identity(),
AxiomSemantics.INSTANCE);
     }
     
     public final OMAttribute AxiomElement.getAttribute(QName qname) {

Modified: webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMElement.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMElement.java?rev=1735002&r1=1735001&r2=1735002&view=diff
==============================================================================
--- webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMElement.java
(original)
+++ webservices/axiom/trunk/implementations/fom-impl/src/main/java/org/apache/abdera/parser/stax/FOMElement.java
Mon Mar 14 23:30:52 2016
@@ -60,8 +60,8 @@ import org.apache.axiom.core.CoreChildNo
 import org.apache.axiom.core.CoreModelException;
 import org.apache.axiom.core.CoreNSAwareElement;
 import org.apache.axiom.core.ElementMatcher;
-import org.apache.axiom.core.IdentityMapper;
 import org.apache.axiom.core.Mapper;
+import org.apache.axiom.core.Mappers;
 import org.apache.axiom.fom.AbderaElement;
 import org.apache.axiom.fom.FOMList;
 import org.apache.axiom.fom.FOMSemantics;
@@ -234,11 +234,9 @@ public class FOMElement extends FOMChild
         }
     }
 
-    private static final IdentityMapper<AbderaElement,AbderaElement> abderaElementMapper
= new IdentityMapper<AbderaElement,AbderaElement>();
-    
     public final Iterator<AbderaElement> _getChildrenWithName(QName qname) {
         return coreGetElements(Axis.CHILDREN, AbderaElement.class, ElementMatcher.BY_QNAME,
-                qname.getNamespaceURI(), qname.getLocalPart(), abderaElementMapper, FOMSemantics.INSTANCE);
+                qname.getNamespaceURI(), qname.getLocalPart(), Mappers.<AbderaElement>identity(),
FOMSemantics.INSTANCE);
     }
 
     public <E extends Element> List<E> _getChildrenAsSet(QName qname) {



Mime
View raw message