ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1737501 - in /webservices/axiom/trunk: aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/ axiom-api/src/main/java/org/apache/axiom/om/ systests/old-tests/src/test/java/org/apache/axiom/om/impl/mtom/ testing/axiom-testsuite/sr...
Date Sat, 02 Apr 2016 13:06:55 GMT
Author: veithen
Date: Sat Apr  2 13:06:55 2016
New Revision: 1737501

URL: http://svn.apache.org/viewvc?rev=1737501&view=rev
Log:
Use more meaningful return types for getDescendants.

Modified:
    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/AxiomDocumentSupport.aj
    webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomElementSupport.aj
    webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/OMContainer.java
    webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/OMDocument.java
    webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/OMElement.java
    webservices/axiom/trunk/systests/old-tests/src/test/java/org/apache/axiom/om/impl/mtom/MTOMStAXSOAPModelBuilderTest.java
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetDescendants.java
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetDescendants.java
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetXMLStreamReaderOnNonRootElementPartiallyBuilt.java
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/sr/TestGetElementTextFromParser.java
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/xop/TestSetOptimize.java
    webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/mtom/TestBuilderDetach.java

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=1737501&r1=1737500&r2=1737501&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
Sat Apr  2 13:06:55 2016
@@ -195,10 +195,6 @@ public aspect AxiomContainerSupport {
                 Mappers.<OMElement>identity(), AxiomSemantics.INSTANCE);
     }
     
-    public Iterator<OMSerializable> AxiomContainer.getDescendants(boolean includeSelf)
{
-        return coreGetNodes(includeSelf ? Axis.DESCENDANTS_OR_SELF : Axis.DESCENDANTS, AxiomSerializable.class,
Mappers.<OMSerializable>identity(), AxiomSemantics.INSTANCE);
-    }
-
     public final OMElement AxiomContainer.getFirstChildWithName(QName name) throws OMException
{
         try {
             CoreChildNode child = coreGetFirstChild();

Modified: webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomDocumentSupport.aj
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomDocumentSupport.aj?rev=1737501&r1=1737500&r2=1737501&view=diff
==============================================================================
--- webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomDocumentSupport.aj
(original)
+++ webservices/axiom/trunk/aspects/om-aspects/src/main/java/org/apache/axiom/om/impl/mixin/AxiomDocumentSupport.aj
Sat Apr  2 13:06:55 2016
@@ -18,15 +18,21 @@
  */
 package org.apache.axiom.om.impl.mixin;
 
+import java.util.Iterator;
+
+import org.apache.axiom.core.Axis;
 import org.apache.axiom.core.CoreElement;
 import org.apache.axiom.core.CoreModelException;
+import org.apache.axiom.core.Mappers;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMException;
 import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMSerializable;
 import org.apache.axiom.om.impl.common.AxiomExceptionTranslator;
 import org.apache.axiom.om.impl.common.AxiomSemantics;
 import org.apache.axiom.om.impl.intf.AxiomDocument;
 import org.apache.axiom.om.impl.intf.AxiomElement;
+import org.apache.axiom.om.impl.intf.AxiomSerializable;
 
 public aspect AxiomDocumentSupport {
     public final OMElement AxiomDocument.getOMDocumentElement() {
@@ -102,4 +108,8 @@ public aspect AxiomDocumentSupport {
     public final CoreElement AxiomDocument.getContextElement() {
         return null;
     }
+
+    public Iterator<OMSerializable> AxiomDocument.getDescendants(boolean includeSelf)
{
+        return coreGetNodes(includeSelf ? Axis.DESCENDANTS_OR_SELF : Axis.DESCENDANTS, AxiomSerializable.class,
Mappers.<OMSerializable>identity(), AxiomSemantics.INSTANCE);
+    }
 }

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=1737501&r1=1737500&r2=1737501&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
Sat Apr  2 13:06:55 2016
@@ -60,6 +60,7 @@ import org.apache.axiom.om.impl.common.N
 import org.apache.axiom.om.impl.common.NamespaceIterator;
 import org.apache.axiom.om.impl.common.OMNamespaceImpl;
 import org.apache.axiom.om.impl.intf.AxiomAttribute;
+import org.apache.axiom.om.impl.intf.AxiomChildNode;
 import org.apache.axiom.om.impl.intf.AxiomElement;
 import org.apache.axiom.om.impl.intf.AxiomNamespaceDeclaration;
 import org.apache.axiom.om.impl.intf.Sequence;
@@ -570,4 +571,8 @@ public aspect AxiomElementSupport {
         CoreParentNode parent = coreGetParent();
         return parent instanceof CoreElement ? (CoreElement)parent : null;
     }
+
+    public Iterator<OMNode> AxiomElement.getDescendants(boolean includeSelf) {
+        return coreGetNodes(includeSelf ? Axis.DESCENDANTS_OR_SELF : Axis.DESCENDANTS, AxiomChildNode.class,
Mappers.<OMNode>identity(), AxiomSemantics.INSTANCE);
+    }
 }

Modified: webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/OMContainer.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/OMContainer.java?rev=1737501&r1=1737500&r2=1737501&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/OMContainer.java (original)
+++ webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/OMContainer.java Sat
Apr  2 13:06:55 2016
@@ -121,7 +121,7 @@ public interface OMContainer extends OMS
      *            child of the container
      * @return an iterator over the descendants of this container
      */
-    Iterator<OMSerializable> getDescendants(boolean includeSelf);
+    Iterator<? extends OMSerializable> getDescendants(boolean includeSelf);
 
     /**
      * Gets the first child.

Modified: webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/OMDocument.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/OMDocument.java?rev=1737501&r1=1737500&r2=1737501&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/OMDocument.java (original)
+++ webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/OMDocument.java Sat
Apr  2 13:06:55 2016
@@ -19,6 +19,8 @@
 
 package org.apache.axiom.om;
 
+import java.util.Iterator;
+
 public interface OMDocument extends OMContainer {
 
     /** Field XML_10 XML Version 1.0 */
@@ -109,4 +111,9 @@ public interface OMDocument extends OMCo
     String isStandalone();
 
     void setStandalone(String isStandalone);
+
+    /**
+     * {@inheritDoc}
+     */
+    Iterator<OMSerializable> getDescendants(boolean includeSelf);
 }

Modified: webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/OMElement.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/OMElement.java?rev=1737501&r1=1737500&r2=1737501&view=diff
==============================================================================
--- webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/OMElement.java (original)
+++ webservices/axiom/trunk/axiom-api/src/main/java/org/apache/axiom/om/OMElement.java Sat
Apr  2 13:06:55 2016
@@ -714,4 +714,9 @@ public interface OMElement extends OMNod
     //       warning when using the method on an OMElement.
     void serializeAndConsume(Writer writer, OMOutputFormat format)
             throws XMLStreamException;
+
+    /**
+     * {@inheritDoc}
+     */
+    Iterator<OMNode> getDescendants(boolean includeSelf);
 }

Modified: webservices/axiom/trunk/systests/old-tests/src/test/java/org/apache/axiom/om/impl/mtom/MTOMStAXSOAPModelBuilderTest.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/systests/old-tests/src/test/java/org/apache/axiom/om/impl/mtom/MTOMStAXSOAPModelBuilderTest.java?rev=1737501&r1=1737500&r2=1737501&view=diff
==============================================================================
--- webservices/axiom/trunk/systests/old-tests/src/test/java/org/apache/axiom/om/impl/mtom/MTOMStAXSOAPModelBuilderTest.java
(original)
+++ webservices/axiom/trunk/systests/old-tests/src/test/java/org/apache/axiom/om/impl/mtom/MTOMStAXSOAPModelBuilderTest.java
Sat Apr  2 13:06:55 2016
@@ -22,8 +22,8 @@ package org.apache.axiom.om.impl.mtom;
 import org.apache.axiom.attachments.Attachments;
 import org.apache.axiom.om.OMDocument;
 import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axiom.om.OMSerializable;
 import org.apache.axiom.om.OMText;
 import org.apache.axiom.om.OMXMLBuilderFactory;
 import org.apache.axiom.soap.SOAPModelBuilder;
@@ -111,9 +111,9 @@ public class MTOMStAXSOAPModelBuilderTes
         SOAPModelBuilder builder = OMXMLBuilderFactory.createSOAPModelBuilder(attachments);
         OMDocument doc = builder.getDocument();
         // Find all the binary nodes
-        List/*<OMText>*/ binaryNodes = new ArrayList();
-        for (Iterator it = doc.getDescendants(false); it.hasNext(); ) {
-            OMNode node = (OMNode)it.next();
+        List<OMText> binaryNodes = new ArrayList<>();
+        for (Iterator<OMSerializable> it = doc.getDescendants(false); it.hasNext();
) {
+            OMSerializable node = it.next();
             if (node instanceof OMText) {
                 OMText text = (OMText)node;
                 if (text.isBinary()) {
@@ -124,10 +124,10 @@ public class MTOMStAXSOAPModelBuilderTes
         assertFalse(binaryNodes.isEmpty());
         // At this moment only the SOAP part should have been loaded
         assertEquals(1, attachments.getContentIDList().size());
-        for (Iterator it = binaryNodes.iterator(); it.hasNext(); ) {
+        for (OMText node : binaryNodes) {
             // Request the DataHandler and do something with it to make sure
             // the part is loaded
-            ((OMText)it.next()).getDataHandler().getInputStream().close();
+            node.getDataHandler().getInputStream().close();
         }
         assertEquals(binaryNodes.size() + 1, attachments.getContentIDList().size());
     }

Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetDescendants.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetDescendants.java?rev=1737501&r1=1737500&r2=1737501&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetDescendants.java
(original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/container/TestGetDescendants.java
Sat Apr  2 13:06:55 2016
@@ -28,6 +28,7 @@ import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMMetaFactory;
 import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMSerializable;
 import org.apache.axiom.om.OMText;
 import org.apache.axiom.ts.AxiomTestCase;
 
@@ -51,7 +52,7 @@ public class TestGetDescendants extends
         OMText child2 = factory.createOMText(root, "text", OMNode.CDATA_SECTION_NODE);
         OMText grandchild1 = factory.createOMText(child1, "text");
         OMComment grandchild2 = factory.createOMComment(child1, "text");
-        Iterator it = root.getDescendants(includeSelf);
+        Iterator<? extends OMSerializable> it = root.getDescendants(includeSelf);
         if (includeSelf) {
             assertThat(it.hasNext()).isTrue();
             assertThat(it.next()).isEqualTo(root);

Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetDescendants.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetDescendants.java?rev=1737501&r1=1737500&r2=1737501&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetDescendants.java
(original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetDescendants.java
Sat Apr  2 13:06:55 2016
@@ -22,6 +22,7 @@ import java.util.Iterator;
 
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.util.AXIOMUtil;
 import org.apache.axiom.ts.AxiomTestCase;
 
@@ -39,7 +40,7 @@ public class TestGetDescendants extends
                 "<root><a><b><c><d/><e/></c></b><f/></a><g/></root>");
         // We intentionally get the descendants of <a> so that we can test containment
         // (the iterator must never return <g>, which is a sibling of <a>).
-        Iterator it = element.getFirstElement().getDescendants(includeSelf);
+        Iterator<OMNode> it = element.getFirstElement().getDescendants(includeSelf);
         if (includeSelf) {
             assertEquals("a", ((OMElement)it.next()).getLocalName());
         }

Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetXMLStreamReaderOnNonRootElementPartiallyBuilt.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetXMLStreamReaderOnNonRootElementPartiallyBuilt.java?rev=1737501&r1=1737500&r2=1737501&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetXMLStreamReaderOnNonRootElementPartiallyBuilt.java
(original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/TestGetXMLStreamReaderOnNonRootElementPartiallyBuilt.java
Sat Apr  2 13:06:55 2016
@@ -25,6 +25,7 @@ import javax.xml.stream.XMLStreamReader;
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.util.AXIOMUtil;
 import org.apache.axiom.ts.AxiomTestCase;
 import org.apache.axiom.util.stax.debug.XMLStreamReaderValidator;
@@ -53,7 +54,7 @@ public class TestGetXMLStreamReaderOnNon
         
         // Partially build the tree
         if (build > 0) {
-            Iterator it = root.getDescendants(false);
+            Iterator<OMNode> it = root.getDescendants(false);
             for (int i=0; i<build; i++) {
                 it.next();
             }

Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/sr/TestGetElementTextFromParser.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/sr/TestGetElementTextFromParser.java?rev=1737501&r1=1737500&r2=1737501&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/sr/TestGetElementTextFromParser.java
(original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/element/sr/TestGetElementTextFromParser.java
Sat Apr  2 13:06:55 2016
@@ -26,6 +26,7 @@ import javax.xml.stream.XMLStreamReader;
 import org.apache.axiom.om.OMContainer;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMMetaFactory;
+import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMXMLParserWrapper;
 import org.apache.axiom.ts.AxiomTestCase;
 import org.apache.axiom.ts.dimension.BuilderFactory;
@@ -65,7 +66,7 @@ public class TestGetElementTextFromParse
         // Build a certain number of descendants. This is used to test scenarios where the
XMLStreamReader
         // needs to switch to pull through mode in the middle of the element from which we
attempt to
         // get the text.
-        Iterator it = element.getDescendants(true);
+        Iterator<OMNode> it = element.getDescendants(true);
         for (int i=0; i<build; i++) {
             it.next();
         }

Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/xop/TestSetOptimize.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/xop/TestSetOptimize.java?rev=1737501&r1=1737500&r2=1737501&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/xop/TestSetOptimize.java
(original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/om/xop/TestSetOptimize.java
Sat Apr  2 13:06:55 2016
@@ -34,6 +34,7 @@ import org.apache.axiom.om.OMDocument;
 import org.apache.axiom.om.OMMetaFactory;
 import org.apache.axiom.om.OMNode;
 import org.apache.axiom.om.OMOutputFormat;
+import org.apache.axiom.om.OMSerializable;
 import org.apache.axiom.om.OMText;
 import org.apache.axiom.om.OMXMLBuilderFactory;
 import org.apache.axiom.om.util.StAXParserConfiguration;
@@ -56,8 +57,8 @@ public class TestSetOptimize extends Axi
                     metaFactory.getOMFactory(),
                     StAXParserConfiguration.DEFAULT,
                     new Attachments(in, XOP_SPEC_SAMPLE.getContentType())).getDocument();
-            for (Iterator it = document.getDescendants(false); it.hasNext(); ) {
-                OMNode node = (OMNode)it.next();
+            for (Iterator<OMSerializable> it = document.getDescendants(false); it.hasNext();
) {
+                OMSerializable node = it.next();
                 if (node instanceof OMText) {
                     OMText text = (OMText)node;
                     if (text.isBinary()) {

Modified: webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/mtom/TestBuilderDetach.java
URL: http://svn.apache.org/viewvc/webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/mtom/TestBuilderDetach.java?rev=1737501&r1=1737500&r2=1737501&view=diff
==============================================================================
--- webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/mtom/TestBuilderDetach.java
(original)
+++ webservices/axiom/trunk/testing/axiom-testsuite/src/main/java/org/apache/axiom/ts/soap12/mtom/TestBuilderDetach.java
Sat Apr  2 13:06:55 2016
@@ -51,8 +51,8 @@ public class TestBuilderDetach extends A
         ASSERT.that(in.getCount()).isGreaterThan(countBeforeDetach);
         ASSERT.that(in.isClosed()).isFalse();
         int binaryCount = 0;
-        for (Iterator it = envelope.getDescendants(false); it.hasNext(); ) {
-            OMNode node = (OMNode)it.next();
+        for (Iterator<OMNode> it = envelope.getDescendants(false); it.hasNext(); )
{
+            OMNode node = it.next();
             if (node instanceof OMText) {
                 OMText text = (OMText)node;
                 if (text.isBinary()) {



Mime
View raw message