Package com.oorian.data.converter
Class StringToBooleanConverter
java.lang.Object
com.oorian.data.converter.StringToBooleanConverter
Converts between
String and Boolean.
Recognizes "true", "yes", and "1" (case-insensitive) as true.
All other non-empty values are treated as false.
- Since:
- 2.1
- Version:
- 1.0
- Author:
- Marvin P. Warble Jr.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconvertToModel(String value) Converts a presentation value to its model representation.convertToPresentation(Boolean value) Converts a model value to its presentation representation.
-
Constructor Details
-
StringToBooleanConverter
public StringToBooleanConverter()Creates a new StringToBooleanConverter.
-
-
Method Details
-
convertToModel
Description copied from interface:ConverterConverts a presentation value to its model representation.- Specified by:
convertToModelin interfaceConverter<String,Boolean> - Parameters:
value- the presentation value to convert (may be null)- Returns:
- the model value
- Throws:
ConversionException- if conversion fails
-
convertToPresentation
Description copied from interface:ConverterConverts a model value to its presentation representation.- Specified by:
convertToPresentationin interfaceConverter<String,Boolean> - Parameters:
value- the model value to convert (may be null)- Returns:
- the presentation value
-