List of utility methods to do Object to Boolean
boolean | castBoolean(Object obj) cast Boolean return castBoolean(obj, false);
|
Boolean | castToBoolean(Object value) cast To Boolean if (value == null) { return null; if (value instanceof Boolean) { return (Boolean) value; if (value instanceof Number) { return ((Number) value).intValue() > 0; ... |
Boolean | castToBoolean(Object value) cast To Boolean return (Boolean) value;
|
boolean | castToBoolean(String fieldValue) Cast a string representation of a boolean value to a boolean primitive. String lowerField = fieldValue.toLowerCase(); switch (lowerField) { case "y": return true; case "n": return false; case "true": return true; ... |
boolean | objectToBoolean(Object o) object To Boolean return o != null ? Boolean.valueOf(o.toString()).booleanValue() : false;
|
boolean | objectToBoolean(Object o) object To Boolean if (o instanceof String) { return Boolean.parseBoolean((String) o); } else if (o instanceof Boolean) { return ((Boolean) o).booleanValue(); } else { throw new Exception("Invalid option value " + o); |
boolean | objectToBoolean(Object Obj) object To Boolean String CadBooleana = objectToString(Obj); Boolean booleano = new Boolean(CadBooleana); return booleano; |
boolean | objectToBoolean(Object p1) object To Boolean if (p1 == null) { return false; return (boolean) (Boolean) p1; |
Boolean | toBoolean(Object object) to Boolean if (null == object) { throw new IllegalArgumentException("object can't be null/empty!"); return Boolean.parseBoolean(object.toString()); |
boolean | toBoolean(Object propValue, boolean defaultValue) to Boolean propValue = toObject(propValue); if (propValue instanceof Boolean) return (Boolean) propValue; if (propValue != null) return Boolean.valueOf(String.valueOf(propValue)); else return defaultValue; |