cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject cayenne git commit: minor cleanup - a faster and more inclusive ConversionUtil checks
Date Sat, 08 Dec 2018 11:34:21 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master 34ad5252c -> 8984621bb


minor cleanup - a faster and more inclusive ConversionUtil checks

* Will cover String, StringBuffer and StringBuilder in one shot.
  Not that many people apply ConversionUtil to builders...


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

Branch: refs/heads/master
Commit: 8984621bb5c446aedf107555c8d4414cff4ed9b7
Parents: 34ad525
Author: Andrus Adamchik <andrus@objectstyle.com>
Authored: Sat Dec 8 14:33:34 2018 +0300
Committer: Andrus Adamchik <andrus@objectstyle.com>
Committed: Sat Dec 8 14:33:39 2018 +0300

----------------------------------------------------------------------
 .../main/java/org/apache/cayenne/util/ConversionUtil.java | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/8984621b/cayenne-server/src/main/java/org/apache/cayenne/util/ConversionUtil.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/util/ConversionUtil.java b/cayenne-server/src/main/java/org/apache/cayenne/util/ConversionUtil.java
index 69f00aa..a86b93d 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/util/ConversionUtil.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/util/ConversionUtil.java
@@ -20,11 +20,11 @@
 
 package org.apache.cayenne.util;
 
+import org.apache.cayenne.exp.ExpressionException;
+
 import java.math.BigDecimal;
 import java.math.BigInteger;
 
-import org.apache.cayenne.exp.ExpressionException;
-
 /**
  * A collection of static conversion utility methods.
  * 
@@ -139,9 +139,7 @@ public final class ConversionUtil {
     public static String toString(Object object) {
         if (object == null) {
             return null;
-        } else if (object instanceof String) {
-            return (String) object;
-        } else if (object instanceof StringBuffer) {
+        } else if (object instanceof CharSequence) {
             return object.toString();
         } else if (object instanceof char[]) {
             return new String((char[]) object);
@@ -155,7 +153,7 @@ public final class ConversionUtil {
      * Attempts to convert an object to an uppercase string.
      */
     public static Object toUpperCase(Object object) {
-        if ((object instanceof String) || (object instanceof StringBuffer)) {
+        if (object instanceof CharSequence) {
             return object.toString().toUpperCase();
         } else if (object instanceof char[]) {
             return new String((char[]) object).toUpperCase();


Mime
View raw message