Author: adrianc
Date: Wed Apr 25 16:22:16 2012
New Revision: 1330386
URL:
http://svn.apache.org/viewvc?rev=1330386&view=revLog:
Improved ObjectType.isEmpty method - removed unnecessary calls to UtilValidate.
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ObjectType.java
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ObjectType.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ObjectType.java?rev=1330386&r1=1330385&r2=1330386&view=diff==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ObjectType.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/ObjectType.java Wed Apr 25 16:22:16 2012
@@ -760,18 +760,18 @@ public class ObjectType {
public static boolean isEmpty(Object value) {
if (value == null) return true;
- if (value instanceof String) return UtilValidate.isEmpty((String) value);
- if (value instanceof Collection) return UtilValidate.isEmpty((Collection<? extends Object>) value);
- if (value instanceof Map) return UtilValidate.isEmpty((Map<? extends Object, ? extends Object>) value);
- if (value instanceof CharSequence) return UtilValidate.isEmpty((CharSequence) value);
- if (value instanceof IsEmpty) return UtilValidate.isEmpty((IsEmpty) value);
+ if (value instanceof String) return ((String) value).length() == 0;
+ if (value instanceof Collection) return ((Collection<? extends Object>) value).size() == 0;
+ if (value instanceof Map) return ((Map<? extends Object, ? extends Object>) value).size() == 0;
+ if (value instanceof CharSequence) return ((CharSequence) value).length() == 0;
+ if (value instanceof IsEmpty) return ((IsEmpty) value).isEmpty();
// These types would flood the log
// Number covers: BigDecimal, BigInteger, Byte, Double, Float, Integer, Long, Short
if (value instanceof Boolean) return false;
if (value instanceof Number) return false;
if (value instanceof Character) return false;
- if (value instanceof java.sql.Timestamp) return false;
+ if (value instanceof java.util.Date) return false;
if (Debug.verboseOn()) {
Debug.logVerbose("In ObjectType.isEmpty(Object value) returning false for " + value.getClass() + " Object.", module);