|
@@ -21,6 +21,10 @@ public abstract class CompareUtils {
|
|
|
if (source.equals(target)) {
|
|
|
return true;
|
|
|
}
|
|
|
+
|
|
|
+ if (source instanceof Boolean) {
|
|
|
+ return compare(((Boolean) source), target);
|
|
|
+ }
|
|
|
if (source instanceof Number) {
|
|
|
return compare(((Number) source), target);
|
|
|
}
|
|
@@ -178,9 +182,9 @@ public abstract class CompareUtils {
|
|
|
DateFormatter dateFormatter = DateFormatter.getFormatter(stringValue);
|
|
|
return (dateFormatter.toString(new Date(number.longValue())).equals(stringValue));
|
|
|
}
|
|
|
- try{
|
|
|
+ try {
|
|
|
return new BigDecimal(stringValue).doubleValue() == number.doubleValue();
|
|
|
- }catch (NumberFormatException e){
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
@@ -235,6 +239,18 @@ public abstract class CompareUtils {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ public static boolean compare(Boolean bool, Object target) {
|
|
|
+ if (bool.equals(target)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (bool && "true".equals(target)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
public static boolean compare(Date date, Object target) {
|
|
|
if (date == target) {
|
|
|
return true;
|