public boolean getBoolean ( final String key , final boolean def ) { Object foo = get ( key ) ; if ( foo == null ) { return def ; } if ( foo instanceof Number ) { return ( ( Number ) foo ) . intValue ( ) > 0 ; } if ( foo instanceof Boolean ) { return ( Boolean ) foo ; } throw new IllegalArgumentException ( "can't coerce to bool:" + foo . getClass ( ) ) ; }
Returns the value of a field as a boolean