open class CustomNumberEditor : PropertyEditorSupport
Property editor for any Number subclass such as Short, Integer, Long, BigInteger, Float, Double, BigDecimal. Can use a given NumberFormat for (locale-specific) parsing and rendering, or alternatively the default decode / valueOf / toString methods.
This is not meant to be used as system PropertyEditor but rather as locale-specific number editor within custom controller code, parsing user-entered number strings into Number properties of beans and rendering them in the UI form.
In web MVC code, this editor will typically be registered with binder.registerCustomEditor calls.
Author
Juergen Hoeller
Since
06.06.2003
See Also
Numberjava.text.NumberFormatorg.springframework.validation.DataBinder#registerCustomEditor
CustomNumberEditor(numberClass: Class<out Number>, allowEmpty: Boolean)
Create a new CustomNumberEditor instance, using the default The "allowEmpty" parameter states if an empty String should be allowed for parsing, i.e. get interpreted as CustomNumberEditor(numberClass: Class<out Number>, numberFormat: NumberFormat, allowEmpty: Boolean)
Create a new CustomNumberEditor instance, using the given NumberFormat for parsing and rendering. The allowEmpty parameter states if an empty String should be allowed for parsing, i.e. get interpreted as |
open fun getAsText(): String
Format the Number as String, using the specified NumberFormat. |
|
open fun setAsText(text: String): Unit
Parse the Number from the given text, using the specified NumberFormat. |
|
open fun setValue(value: Any): Unit
Coerce a Number value into the required target class, if necessary. |