camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bvah...@apache.org
Subject svn commit: r1366374 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/util/ObjectHelper.java test/java/org/apache/camel/util/ObjectHelperTest.java
Date Fri, 27 Jul 2012 13:05:28 GMT
Author: bvahdat
Date: Fri Jul 27 13:05:28 2012
New Revision: 1366374

URL: http://svn.apache.org/viewvc?rev=1366374&view=rev
Log:
Removed the obsolete usage of the CastUtils.cast(Iterator<?> p) utility.

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/util/ObjectHelperTest.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java?rev=1366374&r1=1366373&r2=1366374&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java Fri Jul 27
13:05:28 2012
@@ -520,14 +520,14 @@ public final class ObjectHelper {
         } else if (value instanceof NodeList) {
             // lets iterate through DOM results after performing XPaths
             final NodeList nodeList = (NodeList) value;
-            return CastUtils.cast(new Iterator<Node>() {
+            return new Iterator<Object>() {
                 int idx = -1;
 
                 public boolean hasNext() {
                     return (idx + 1) < nodeList.getLength();
                 }
 
-                public Node next() {
+                public Object next() {
                     idx++;
                     return nodeList.item(idx);
                 }
@@ -535,7 +535,7 @@ public final class ObjectHelper {
                 public void remove() {
                     throw new UnsupportedOperationException();
                 }
-            });
+            };
         } else if (value instanceof String) {
             final String s = (String) value;
 
@@ -563,14 +563,14 @@ public final class ObjectHelper {
                 return CastUtils.cast(scanner);
             } else {
                 // use a plain iterator that returns the value as is as there are only a
single value
-                return CastUtils.cast(new Iterator<String>() {
+                return new Iterator<Object>() {
                     int idx = -1;
 
                     public boolean hasNext() {
                         return idx + 1 == 0 && (allowEmptyValues || ObjectHelper.isNotEmpty(s));
                     }
 
-                    public String next() {
+                    public Object next() {
                         idx++;
                         return s;
                     }
@@ -578,7 +578,7 @@ public final class ObjectHelper {
                     public void remove() {
                         throw new UnsupportedOperationException();
                     }
-                });
+                };
             }
         } else {
             return Collections.singletonList(value).iterator();

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/util/ObjectHelperTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/util/ObjectHelperTest.java?rev=1366374&r1=1366373&r2=1366374&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/util/ObjectHelperTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/util/ObjectHelperTest.java Fri Jul
27 13:05:28 2012
@@ -141,7 +141,7 @@ public class ObjectHelperTest extends Te
 
     public void testCreateIteratorAllowEmpty() {
         String s = "a,b,,c";
-        Iterator<String> it = CastUtils.cast(ObjectHelper.createIterator(s, ",", true));
+        Iterator<?> it = ObjectHelper.createIterator(s, ",", true);
         assertEquals("a", it.next());
         assertEquals("b", it.next());
         assertEquals("", it.next());
@@ -150,7 +150,7 @@ public class ObjectHelperTest extends Te
 
     public void testCreateIteratorWithStringAndCommaSeparator() {
         String s = "a,b,c";
-        Iterator<String> it = CastUtils.cast(ObjectHelper.createIterator(s, ","));
+        Iterator<?> it = ObjectHelper.createIterator(s, ",");
         assertEquals("a", it.next());
         assertEquals("b", it.next());
         assertEquals("c", it.next());
@@ -158,14 +158,14 @@ public class ObjectHelperTest extends Te
 
     public void testCreateIteratorWithStringAndCommaSeparatorEmptyString() {
         String s = "";
-        Iterator<String> it = CastUtils.cast(ObjectHelper.createIterator(s, ",", true));
+        Iterator<?> it = ObjectHelper.createIterator(s, ",", true);
         assertEquals("", it.next());
         assertFalse(it.hasNext());
     }
 
     public void testCreateIteratorWithStringAndSemiColonSeparator() {
         String s = "a;b;c";
-        Iterator<String> it = CastUtils.cast(ObjectHelper.createIterator(s, ";"));
+        Iterator<?> it = ObjectHelper.createIterator(s, ";");
         assertEquals("a", it.next());
         assertEquals("b", it.next());
         assertEquals("c", it.next());
@@ -173,13 +173,13 @@ public class ObjectHelperTest extends Te
 
     public void testCreateIteratorWithStringAndCommaInParanthesesSeparator() {
         String s = "bean:foo?method=bar('A','B','C')";
-        Iterator<String> it = CastUtils.cast(ObjectHelper.createIterator(s, ","));
+        Iterator<?> it = ObjectHelper.createIterator(s, ",");
         assertEquals("bean:foo?method=bar('A','B','C')", it.next());
     }
 
     public void testCreateIteratorWithStringAndCommaInParanthesesSeparatorTwo() {
         String s = "bean:foo?method=bar('A','B','C'),bean:bar?method=cool('A','Hello,World')";
-        Iterator<String> it = CastUtils.cast(ObjectHelper.createIterator(s, ","));
+        Iterator<?> it = ObjectHelper.createIterator(s, ",");
         assertEquals("bean:foo?method=bar('A','B','C')", it.next());
         assertEquals("bean:bar?method=cool('A','Hello,World')", it.next());
     }
@@ -277,7 +277,7 @@ public class ObjectHelperTest extends Te
         Message msg = new DefaultMessage();
         msg.setBody("a,b,c");
 
-        Iterator<String> it = CastUtils.cast(ObjectHelper.createIterator(msg));
+        Iterator<?> it = ObjectHelper.createIterator(msg);
         assertEquals("a", it.next());
         assertEquals("b", it.next());
         assertEquals("c", it.next());
@@ -310,7 +310,7 @@ public class ObjectHelperTest extends Te
                 return data.iterator();
             }
         };
-        Iterator<String> it = CastUtils.cast(ObjectHelper.createIterator(itb));
+        Iterator<?> it = ObjectHelper.createIterator(itb);
         assertEquals("A", it.next());
         assertEquals("B", it.next());
         assertEquals("C", it.next());



Mime
View raw message