public static boolean toBoolean ( Object value , boolean defaultValue ) { boolean result ; // = defaultValue; if ( value != null ) { if ( value instanceof Boolean ) { return ( ( Boolean ) value ) . booleanValue ( ) ; } if ( value . toString ( ) . trim ( ) . equals ( "1" ) || value . toString ( ) . trim ( ) . toLowerCase ( ) . equals ( "true" ) ) { result = true ; } else { result = false ; } } else { result = defaultValue ; } return result ; }
To boolean .