Optionally allows transforming an empty string into a null value.
Needs to be explicitly registered, e.g. for command binding.
org.springframework.validation.DataBinder#registerCustomEditor
| Modifier and Type | Field and Description |
|---|---|
| private final String | |
| private final boolean |
| Access | Constructor and Description |
|---|---|
| public | StringTrimmerEditor(boolean
true if an empty String is to be
transformed into nullCreate a new StringTrimmerEditor. |
| public | StringTrimmerEditor(String
a set of characters to delete, in addition to
trimming an input String. Useful for deleting unwanted line breaks:
e.g. "\r\n\f" will delete all new lines and line feeds in a String. charsToDelete, boolean true if an empty String is to be
transformed into nullCreate a new StringTrimmerEditor. |
| Modifier and Type | Method and Description |
|---|---|
| public String | getAsText()
Overrides java. Implements java. |
| public void | setAsText(String
The string to be parsed. text)Overrides java. Implements java. |
| charsToDelete | back to summary |
|---|---|
| private final String charsToDelete
| |
| emptyAsNull | back to summary |
|---|---|
| private final boolean emptyAsNull | |
| StringTrimmerEditor | back to summary |
|---|---|
| public StringTrimmerEditor(boolean emptyAsNull) Create a new StringTrimmerEditor.
| |
| StringTrimmerEditor | back to summary |
|---|---|
| public StringTrimmerEditor(String charsToDelete, boolean emptyAsNull) Create a new StringTrimmerEditor.
| |
| 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) 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. | |