JBStrap booleanconverter

BooleanConverter

BooleanConverter is a JBStrap parameter. The default YES_NO. JBStrap parameters are detailed in the Application Startup chapter.

Use it to convert an object into a logic value, such as when converting stored database values into logical ones or a parameter (of whichever type) into logical ones. The converter considers the following values to be TRUE: 1, 1 (Long), „1”, „Y”, „YES”, „TRUE”, „T”, „ON”. The logic converter is not case-sensitive. All other possible values (and NULL values) are converted into FALSE.

To save these values to a database and to retrieve them from there, JBStrap uses pre-defined converters contained in the BooleanConverters enum. These converters work as described above and save values to the database in the following way:

Name

TRUE value

FALSE value

BooleanConverters.YES_NO

"Y"

"N"

BooleanConverters.NUMBER

1

0

BooleanConverters.BOOLEAN (Only usable if the database supports logic values. In this case, no conversion is applied.)

true

false

BooleanConverters.BOOLEAN_STRING

"true"

"false"

RelatedPages