public static Boolean toBoolean(Object o, Boolean defaultValue) {
	if (o instanceof Boolean) return ((Boolean) o);
	else if (o instanceof Number) return ((Number) o).intValue() == 0 ? Boolean.FALSE : Boolean.TRUE;
	else if (o instanceof String) {
	    int rtn = stringToBooleanValueEL(o.toString());
	    if (rtn == 1) return Boolean.TRUE;
	    else if (rtn == 0) return Boolean.FALSE;
	    else {
		double dbl = toDoubleValue(o.toString(), Double.NaN);
		if (!Double.isNaN(dbl)) return toBooleanValue(dbl) ? Boolean.TRUE : Boolean.FALSE;
	    }

	}
	// else if(o instanceof Clob) return toBooleanValueEL(toStringEL(o));
	else if (o instanceof Castable) {
	    return ((Castable) o).castToBoolean(defaultValue);
	}
	else if (o instanceof ObjectWrap) return toBoolean(((ObjectWrap) o).getEmbededObject(defaultValue), defaultValue);

	else if (o == null) return toBoolean("", defaultValue);
	return defaultValue;
    }
public static Boolean toBoolean ( Object o , Boolean defaultValue ) { if ( o instanceof Boolean ) return ( ( Boolean ) o ) ; else if ( o instanceof Number ) return ( ( Number ) o ) . intValue ( ) == 0 ? Boolean . FALSE : Boolean . TRUE ; else if ( o instanceof String ) { int rtn = stringToBooleanValueEL ( o . toString ( ) ) ; if ( rtn == 1 ) return Boolean . TRUE ; else if ( rtn == 0 ) return Boolean . FALSE ; else { double dbl = toDoubleValue ( o . toString ( ) , Double . NaN ) ; if ( ! Double . isNaN ( dbl ) ) return toBooleanValue ( dbl ) ? Boolean . TRUE : Boolean . FALSE ; } } else if ( o instanceof Castable ) { return ( ( Castable ) o ) . castToBoolean ( defaultValue ) ; } else if ( o instanceof ObjectWrap ) return toBoolean ( ( ( ObjectWrap ) o ) . getEmbededObject ( defaultValue ) , defaultValue ) ; else if ( o == null ) return toBoolean ( "" , defaultValue ) ; return defaultValue ; }
cast a Object to a boolean value (refrence type), Exception Less

@param o Object to cast
@param defaultValue default value
@return casted boolean reference