List of utility methods to do Boolean From
Boolean | toBoolean(Object obj) to Boolean if (isNull(obj)) { return getNull(); if (obj instanceof Boolean) { return (Boolean) obj; if ("true".equalsIgnoreCase(obj.toString())) { return Boolean.TRUE; ... |
boolean | toBoolean(Object obj) Converts an object to boolean, according to the following logic:
if (obj != null) { if (obj instanceof Boolean) { return (Boolean) obj; } else { return toBoolean(obj.toString()); } else { return false; ... |
Boolean | toBoolean(Object obj) Converts an Object to a Boolean. if (obj instanceof Boolean) { return (Boolean) obj; } else if (obj instanceof String) { return Boolean.valueOf((String) obj); } else if (obj == null) { return null; } else { return Boolean.FALSE; ... |
boolean | toBoolean(Object obj) to Boolean try { if (obj instanceof String) { if (obj.equals("true") || obj.equals("yes")) { return true; return false; } else if (obj instanceof Integer) { return ((Integer) obj).intValue() == 1; ... |
boolean | toBoolean(Object object) Converts an object to a boolean (return false if the conversion fail) if (object instanceof Boolean) { return ((Boolean) object).booleanValue(); } else if (object instanceof String) { return Boolean.parseBoolean((String) object); } else { return false; |
boolean | toBoolean(Object object) to Boolean if (object instanceof Boolean) { return ((Boolean) object).booleanValue(); if (object instanceof Number) { return ((Number) object).intValue() != 0; return object != null; |
Boolean | toBoolean(Object object) to Boolean Boolean b = null; if (object != null) { if (object instanceof Boolean) b = (Boolean) object; return b; |
boolean | toBoolean(Object object) to Boolean if (object.equals(Boolean.TRUE) || (object instanceof String && (((String) object).equalsIgnoreCase("true")) || ((String) object).equalsIgnoreCase("1")) || ((object instanceof Number) && (((Number) object).intValue() == 1))) { return true; return false; |
Boolean | toBoolean(Object object, Boolean defaultValue) to Boolean if (object == null) { return defaultValue; if (object instanceof Boolean) { return ((Boolean) object).booleanValue(); try { Boolean value = Boolean.valueOf(object.toString().trim()); ... |
boolean | toBoolean(Object property, boolean defaultValue) to Boolean if (property == null) { return defaultValue; return Boolean.parseBoolean(String.valueOf(property)); |