summaryrefslogtreecommitdiffstats
path: root/src/com/iciql/util/Utils.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/iciql/util/Utils.java')
-rw-r--r--src/com/iciql/util/Utils.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/com/iciql/util/Utils.java b/src/com/iciql/util/Utils.java
index 302dd4d..dac30fc 100644
--- a/src/com/iciql/util/Utils.java
+++ b/src/com/iciql/util/Utils.java
@@ -226,6 +226,22 @@ public class Utils {
return o.toString();
}
+ // convert from number to boolean
+ if (Boolean.class.isAssignableFrom(targetType)) {
+ if (Number.class.isAssignableFrom(currentType)) {
+ Number n = (Number) o;
+ return n.intValue() > 0;
+ }
+ }
+
+ // convert from boolean to number
+ if (Boolean.class.isAssignableFrom(currentType)) {
+ if (Number.class.isAssignableFrom(targetType)) {
+ Boolean b = (Boolean) o;
+ return b ? 1 : 0;
+ }
+ }
+
// convert from number to number
if (Number.class.isAssignableFrom(currentType)) {
Number n = (Number) o;