cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject cayenne git commit: removing commons-lang dependency
Date Sun, 02 Oct 2016 12:52:26 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master 8ac060fce -> 827056e81


removing commons-lang dependency


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/827056e8
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/827056e8
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/827056e8

Branch: refs/heads/master
Commit: 827056e815b67501d23c5c5ea0fee84469b6e6dd
Parents: 8ac060f
Author: Andrus Adamchik <andrus@objectstyle.com>
Authored: Sun Oct 2 12:20:51 2016 +0300
Committer: Andrus Adamchik <andrus@objectstyle.com>
Committed: Sun Oct 2 15:52:11 2016 +0300

----------------------------------------------------------------------
 .../reverse/filters/IncludeTableFilter.java     |  1 -
 .../dbsync/reverse/filters/PatternFilter.java   | 12 +++++-----
 .../dbsync/reverse/filters/TableFilter.java     | 10 ++++----
 .../apache/cayenne/dbimport/IncludeTable.java   |  2 --
 .../main/java/org/apache/cayenne/util/Util.java | 25 ++++++++++----------
 5 files changed, 24 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/827056e8/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/filters/IncludeTableFilter.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/filters/IncludeTableFilter.java
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/filters/IncludeTableFilter.java
index ad68b49..7272b2d 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/filters/IncludeTableFilter.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/filters/IncludeTableFilter.java
@@ -55,7 +55,6 @@ public class IncludeTableFilter implements Comparable<IncludeTableFilter>
{
 
     }
 
-
     @Override
     public String toString() {
         return toString(new StringBuilder(), "").toString();

http://git-wip-us.apache.org/repos/asf/cayenne/blob/827056e8/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/filters/PatternFilter.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/filters/PatternFilter.java
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/filters/PatternFilter.java
index 4b0bf45..ee1d9e0 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/filters/PatternFilter.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/filters/PatternFilter.java
@@ -18,7 +18,7 @@
  ****************************************************************/
 package org.apache.cayenne.dbsync.reverse.filters;
 
-import org.apache.commons.lang.StringUtils;
+import org.apache.cayenne.util.Util;
 
 import java.util.Comparator;
 import java.util.SortedSet;
@@ -38,7 +38,7 @@ public class PatternFilter {
         }
 
         @Override
-        public StringBuilder toString(StringBuilder res) {
+        protected StringBuilder toString(StringBuilder res) {
             return res.append("ALL");
         }
     };
@@ -50,7 +50,7 @@ public class PatternFilter {
         }
 
         @Override
-        public StringBuilder toString(StringBuilder res) {
+        protected StringBuilder toString(StringBuilder res) {
             return res.append("NONE");
         }
     };
@@ -147,17 +147,17 @@ public class PatternFilter {
         return includes.hashCode();
     }
 
-    public StringBuilder toString(StringBuilder res) {
+    protected StringBuilder toString(StringBuilder res) {
         if (includes.isEmpty()) {
             // Do nothing.
         } else if (includes.size() > 1) {
-            res.append("(").append(StringUtils.join(includes, " OR ")).append(")");
+            res.append("(").append(Util.join(includes, " OR ")).append(")");
         } else {
             res.append(includes.first().pattern());
         }
 
         if (!excludes.isEmpty()) {
-            res.append(" AND NOT (").append(StringUtils.join(includes, " OR ")).append(")");
+            res.append(" AND NOT (").append(Util.join(includes, " OR ")).append(")");
         }
 
         return res;

http://git-wip-us.apache.org/repos/asf/cayenne/blob/827056e8/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/filters/TableFilter.java
----------------------------------------------------------------------
diff --git a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/filters/TableFilter.java
b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/filters/TableFilter.java
index 266bbc2..44297d8 100644
--- a/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/filters/TableFilter.java
+++ b/cayenne-dbsync/src/main/java/org/apache/cayenne/dbsync/reverse/filters/TableFilter.java
@@ -18,15 +18,15 @@
  ****************************************************************/
 package org.apache.cayenne.dbsync.reverse.filters;
 
-import org.apache.commons.lang.StringUtils;
+
+import org.apache.cayenne.util.Util;
 
 import java.util.SortedSet;
 import java.util.TreeSet;
 import java.util.regex.Pattern;
 
 /**
- * TableFilter contain at least one IncludeTable always
- *
+ * TableFilter contain at least one IncludeTable always.
  */
 public class TableFilter {
 
@@ -34,7 +34,7 @@ public class TableFilter {
     private final SortedSet<Pattern> excludes;
 
     /**
-     * Includes can contain only One includetable
+     * Includes can contain only one include table
      *
      * @param includes
      * @param excludes
@@ -101,7 +101,7 @@ public class TableFilter {
         }
 
         if (!excludes.isEmpty()) {
-            res.append(prefix).append("  ").append(StringUtils.join(excludes, " OR ")).append("\n");
+            res.append(prefix).append("  ").append(Util.join(excludes, " OR ")).append("\n");
         }
 
         return res;

http://git-wip-us.apache.org/repos/asf/cayenne/blob/827056e8/cayenne-server/src/main/java/org/apache/cayenne/dbimport/IncludeTable.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/dbimport/IncludeTable.java b/cayenne-server/src/main/java/org/apache/cayenne/dbimport/IncludeTable.java
index 8509108..c25701f 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/dbimport/IncludeTable.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/dbimport/IncludeTable.java
@@ -24,8 +24,6 @@ import javax.xml.bind.annotation.XmlElement;
 import java.util.Collection;
 import java.util.LinkedList;
 
-import static org.apache.commons.lang.StringUtils.join;
-
 /**
  * @since 4.0.
  */

http://git-wip-us.apache.org/repos/asf/cayenne/blob/827056e8/cayenne-server/src/main/java/org/apache/cayenne/util/Util.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/util/Util.java b/cayenne-server/src/main/java/org/apache/cayenne/util/Util.java
index 14e5eab..8835668 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/util/Util.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/util/Util.java
@@ -121,15 +121,15 @@ public class Util {
 	}
 
 	/**
-	 * @param strings
-	 *            The list of strings to join.
+	 * @param objects
+	 *            An Iterable of objects that will be converted to Strings and joined together.
 	 * @param separator
 	 *            The separator between the strings.
 	 * @return A single string of all the input strings separated by the
 	 *         separator.
 	 */
-	public static String join(List<String> strings, String separator) {
-		if (strings == null || strings.size() == 0) {
+	public static String join(Iterable<?> objects, String separator) {
+		if (objects == null) {
 			return "";
 		}
 
@@ -139,11 +139,12 @@ public class Util {
 
 		StringBuilder builder = new StringBuilder();
 
-		for (String string : strings) {
+		for (Object o : objects) {
 			if (builder.length() > 0) {
 				builder.append(separator);
 			}
 
+			String string = o != null ? o.toString() : "";
 			builder.append(string);
 		}
 
@@ -209,7 +210,7 @@ public class Util {
 	 * Compares two objects similar to "Comparable.compareTo(Object)". Unlike
 	 * Comparable.compareTo(..), this method doesn't throw an exception if any
 	 * of the two objects is null.
-	 * 
+	 *
 	 * @since 1.1
 	 */
 	public static <T> int nullSafeCompare(boolean nullsFirst, Comparable<T> o1,
T o2) {
@@ -285,7 +286,7 @@ public class Util {
 
 	/**
 	 * Returns an unqualified class name for the fully qualified name.
-	 * 
+	 *
 	 * @since 3.0
 	 */
 	public static String stripPackageName(String className) {
@@ -302,7 +303,7 @@ public class Util {
 
 	/**
 	 * Creates a mutable map out of two arrays with keys and values.
-	 * 
+	 *
 	 * @since 1.2
 	 */
 	public static <K, V> Map<K, V> toMap(K[] keys, V[] values) {
@@ -352,7 +353,7 @@ public class Util {
 	/**
 	 * Strips "\n", "\r\n", "\r" from the argument string, replacing them with a
 	 * provided character.
-	 * 
+	 *
 	 * @since 3.1
 	 */
 	public static String stripLineBreaks(String string, char replaceWith) {
@@ -426,7 +427,7 @@ public class Util {
 
 	/**
 	 * Trims long strings substituting middle part with "...".
-	 * 
+	 *
 	 * @param str
 	 *            String to trim.
 	 * @param maxLength
@@ -491,7 +492,7 @@ public class Util {
 	/**
 	 * Returns true if a Member is accessible via reflection under normal Java
 	 * access controls.
-	 * 
+	 *
 	 * @since 1.2
 	 */
 	public static boolean isAccessible(Member member) {
@@ -501,7 +502,7 @@ public class Util {
 	/**
 	 * Creates a Java class, handling regular class names as well as
 	 * single-dimensional arrays and primitive types.
-	 * 
+	 *
 	 * @since 1.2
 	 * @deprecated since 4.0 this method based on statically defined class
 	 *             loading algorithm is not going to work in environments like


Mime
View raw message