spring-framework / org.springframework.beans.propertyeditors / CustomBooleanEditor

CustomBooleanEditor

open class CustomBooleanEditor : PropertyEditorSupport

Property editor for Boolean/boolean properties.

This is not meant to be used as system PropertyEditor but rather as locale-specific Boolean editor within custom controller code, to parse UI-caused boolean strings into boolean properties of beans and check them in the UI form.

In web MVC code, this editor will typically be registered with binder.registerCustomEditor calls.

Author
Juergen Hoeller

Since
10.06.2003

See Also
org.springframework.validation.DataBinder#registerCustomEditor

Constructors

<init>

CustomBooleanEditor(allowEmpty: Boolean)

Create a new CustomBooleanEditor instance, with "true"/"on"/"yes" and "false"/"off"/"no" as recognized String values.

The "allowEmpty" parameter states if an empty String should be allowed for parsing, i.e. get interpreted as null value. Else, an IllegalArgumentException gets thrown in that case.

CustomBooleanEditor(trueString: String, falseString: String, allowEmpty: Boolean)

Create a new CustomBooleanEditor instance, with configurable String values for true and false.

The "allowEmpty" parameter states if an empty String should be allowed for parsing, i.e. get interpreted as null value. Else, an IllegalArgumentException gets thrown in that case.

Properties

VALUE_0

static val VALUE_0: String

VALUE_1

static val VALUE_1: String

VALUE_FALSE

static val VALUE_FALSE: String

VALUE_NO

static val VALUE_NO: String

VALUE_OFF

static val VALUE_OFF: String

VALUE_ON

static val VALUE_ON: String

VALUE_TRUE

static val VALUE_TRUE: String

VALUE_YES

static val VALUE_YES: String

Functions

getAsText

open fun getAsText(): String

setAsText

open fun setAsText(text: String): Unit