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.
org.springframework.validation.DataBinder#registerCustomEditor
| Modifier and Type | Field and Description |
|---|---|
| private final boolean | |
| private final String | |
| private final String | |
| public static final String | VALUE_0
Value of |
| public static final String | VALUE_1
Value of |
| public static final String | VALUE_FALSE
Value of |
| public static final String | VALUE_NO
Value of |
| public static final String | VALUE_OFF
Value of |
| public static final String | VALUE_ON
Value of |
| public static final String | VALUE_TRUE
Value of |
| public static final String | VALUE_YES
Value of |
| Access | Constructor and Description |
|---|---|
| public | CustomBooleanEditor(boolean
if empty strings should be allowed allowEmpty)Create a new CustomBooleanEditor instance, with "true"/"on"/"yes" and "false"/"off"/"no" as recognized String values. |
| public | CustomBooleanEditor(String
the String value that represents true:
for example, "true" (VALUE_TRUE), "on" (VALUE_ON),
"yes" (VALUE_YES) or some custom value trueString, String the String value that represents false:
for example, "false" (VALUE_FALSE), "off" (VALUE_OFF),
"no" (VALUE_NO) or some custom value falseString, boolean if empty strings should be allowed allowEmpty)Create a new CustomBooleanEditor instance, with configurable String values for true and false. |
| Modifier and Type | Method and Description |
|---|---|
| public String | getAsText()
Overrides java. Implements java. Gets the property value as a string suitable for presentation to a human to edit. |
| public void | setAsText(String
The string to be parsed. text)Overrides java. Implements java. Sets the property value by parsing a given String. |
| allowEmpty | back to summary |
|---|---|
| private final boolean allowEmpty | |
| falseString | back to summary |
|---|---|
| private final String falseString
| |
| trueString | back to summary |
|---|---|
| private final String trueString
| |
| VALUE_0 | back to summary |
|---|---|
| public static final String VALUE_0 Value of | |
| VALUE_1 | back to summary |
|---|---|
| public static final String VALUE_1 Value of | |
| VALUE_FALSE | back to summary |
|---|---|
| public static final String VALUE_FALSE Value of | |
| VALUE_NO | back to summary |
|---|---|
| public static final String VALUE_NO Value of | |
| VALUE_OFF | back to summary |
|---|---|
| public static final String VALUE_OFF Value of | |
| VALUE_ON | back to summary |
|---|---|
| public static final String VALUE_ON Value of | |
| VALUE_TRUE | back to summary |
|---|---|
| public static final String VALUE_TRUE Value of | |
| VALUE_YES | back to summary |
|---|---|
| public static final String VALUE_YES Value of | |
| CustomBooleanEditor | back to summary |
|---|---|
| public CustomBooleanEditor(boolean allowEmpty) 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 | back to summary |
|---|---|
| public CustomBooleanEditor(String trueString, String falseString, boolean allowEmpty) 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.
| |
| getAsText | back to summary |
|---|---|
| public String getAsText() Overrides java. Implements java. Doc from java. Gets the property value as a string suitable for presentation to a human to edit. | |
| setAsText | back to summary |
|---|---|
| public void setAsText(String text) throws IllegalArgumentException Overrides java. Implements java. Doc from java. Sets the property value by parsing a given String. May raise java.lang.IllegalArgumentException if either the String is badly formatted or if this kind of property can't be expressed as text. | |