public Optional < Boolean > getBoolean ( String key ) { Objects . requireNonNull ( key , Required . KEY . toString ( ) ) ; String value = this . values . get ( key ) ; if ( StringUtils . isNotBlank ( value ) ) { if ( ( "1" ) . equals ( value ) ) { return Optional . of ( Boolean . TRUE ) ; } else if ( ( "true" ) . equals ( value ) ) { return Optional . of ( Boolean . TRUE ) ; } else if ( ( "false" ) . equals ( value ) ) { return Optional . of ( Boolean . FALSE ) ; } else if ( ( "0" ) . equals ( value ) ) { return Optional . of ( Boolean . FALSE ) ; } else { // Ignore anything else } } return Optional . empty ( ) ; }
Retrieves an optional boolean value corresponding to the name of the form element