1 30 31 32 package org.hsqldb.lib; 33 34 40 public final class BooleanConverter { 41 42 public static Boolean getBoolean(Boolean o) { 43 return o; 44 } 45 46 public static Boolean getBoolean(Double o) { 47 return o.doubleValue() == 0.0 ? Boolean.FALSE 48 : Boolean.TRUE; 49 } 50 51 public static Boolean getBoolean(Integer o) { 52 return ((Number ) o).longValue() == 0L ? Boolean.FALSE 53 : Boolean.TRUE; 54 } 55 56 public static Boolean getBoolean(Long o) { 57 return ((Number ) o).longValue() == 0L ? Boolean.FALSE 58 : Boolean.TRUE; 59 } 60 61 public static Boolean getBoolean(String o) { 62 return o != null && o.toLowerCase().equals("true") ? Boolean.TRUE 63 : Boolean.FALSE; 64 } 65 } 66 | Popular Tags |