List of utility methods to do Boolean From
boolean | toBoolean(final String value) To boolean. return toBoolean(value, DEFAULT_VALUE);
|
boolean | toBoolean(final String value) Helper method. return value.equalsIgnoreCase(STRING_TRUE) || value.equalsIgnoreCase(STRING_YES)
|| value.equalsIgnoreCase(STRING_ENABLED);
|
boolean | toBoolean(final String value, final boolean def) to Boolean if (isEmpty(value)) { return def; return Boolean.parseBoolean(value); |
boolean | toBoolean(int i) Converts a primitive integer to a boolean by using it's value as a marker for the boolean value. return i > 0;
|
boolean | toBoolean(int value) Converts a int to a boolean. return value != 0;
|
boolean | toBoolean(Integer value, Integer trueValue, Integer falseValue) Converts an Integer to a boolean specifying the conversion values. BooleanUtils.toBoolean(new Integer(0), new Integer(1), new Integer(0)) = false BooleanUtils.toBoolean(new Integer(1), new Integer(1), new Integer(0)) = true BooleanUtils.toBoolean(new Integer(2), new Integer(1), new Integer(2)) = false BooleanUtils.toBoolean(new Integer(2), new Integer(2), new Integer(0)) = true BooleanUtils.toBoolean(null, null, new Integer(0)) = true if (value == null) { if (trueValue == null) { return true; } else if (falseValue == null) { return false; } else if (value.equals(trueValue)) { return true; ... |
boolean | toBoolean(Number value) to Boolean return value.intValue() != 0;
|
Boolean | toBoolean(Object anObj) Converts parameter to Boolean. Boolean tmpResult = null; if (anObj == null) { } else if (anObj instanceof Boolean) { tmpResult = (Boolean) anObj; } else { final String tmpStr = toString(anObj); if ("true".equalsIgnoreCase(tmpStr) || "yes".equalsIgnoreCase(tmpStr) || "on".equalsIgnoreCase(tmpStr)) { ... |
boolean | toBoolean(Object bool) to Boolean if (bool == null) return false; if (bool instanceof Boolean) { boolean b = ((Boolean) bool).booleanValue(); return b; bool = bool.toString(); if (bool.equals("true") || bool.equals("y") || bool.equals("on") || bool.equals("1")) ... |
Boolean | toBoolean(Object o) to Boolean if (o == null) return null; if (o.getClass() == Boolean.class) return (Boolean) o; if (o.getClass() == Byte.class) return byteToBoolean(((Byte) o)); if (o.getClass() == Character.class) return charToBoolean(((Character) o)); ... |