public static Boolean castBoolean(Object o) {
        if (o == null) {
            return null;
        }
        if (o instanceof Boolean) {
            return (Boolean) o;
        } else if (o instanceof String) {
            try {
                return Boolean.parseBoolean((String) o);
            } catch (IllegalArgumentException e) {
                return null;
            }
        }

        return null;
    }
public static Boolean castBoolean(Object o) {
        if (o == null) {
            return null;
        }
        if (o instanceof Boolean) {
            return (Boolean) o;
        } else if (o instanceof String) {
            try {
                return Boolean.parseBoolean((String) o);
            } catch (IllegalArgumentException e) {
                return null;
            }
        }

        return null;
    }
public static Boolean castBoolean ( Object o ) { if ( o == null ) { return null ; } if ( o instanceof Boolean ) { return ( Boolean ) o ; } else if ( o instanceof String ) { try { return Boolean . parseBoolean ( ( String ) o ) ; } catch ( IllegalArgumentException e ) { return null ; } } return null ; }
Casts a value to a boolean. May return null.

@param o The object to attempt to cast
@return The object as a boolean
Casts a value to a boolean . May return null .