public static Boolean toBoolean ( Object value ) { if ( value == null ) { return false ; } else if ( value instanceof Boolean ) { return ( Boolean ) value ; } else if ( value instanceof BigDecimal ) { return value . equals ( BigDecimal . ONE ) ; } else if ( value instanceof Long ) { return value . equals ( 1L ) ; } else if ( value instanceof Integer ) { return value . equals ( 1 ) ; } else if ( value instanceof Character ) { return value . equals ( ' ' ) || value . equals ( ' ' ) || value . equals ( ' ' ) || value . equals ( ' ' ) ; } else return value . toString ( ) . equalsIgnoreCase ( "yes" ) || value . toString ( ) . equalsIgnoreCase ( "true" ) || value . toString ( ) . equalsIgnoreCase ( "y" ) || value . toString ( ) . equalsIgnoreCase ( "t" ) || Boolean . parseBoolean ( value . toString ( ) ) ; }
Returns true if the value is any numeric type and has a value of 1 or if string type has a value of y t true or yes . Otherwise return false .