open class CustomDateEditor : PropertyEditorSupport
Property editor for java.util.Date, supporting a custom java.text.DateFormat.
This is not meant to be used as system PropertyEditor but rather as locale-specific date editor within custom controller code, parsing user-entered number strings into Date properties of beans and rendering them in the UI form.
In web MVC code, this editor will typically be registered with binder.registerCustomEditor.
Author
Juergen Hoeller
Since
28.04.2003
See Also
java.util.Datejava.text.DateFormatorg.springframework.validation.DataBinder#registerCustomEditor
CustomDateEditor(dateFormat: DateFormat, allowEmpty: Boolean)
Create a new CustomDateEditor instance, using the given DateFormat for parsing and rendering. The "allowEmpty" parameter states if an empty String should be allowed for parsing, i.e. get interpreted as null value. Otherwise, an IllegalArgumentException gets thrown in that case. CustomDateEditor(dateFormat: DateFormat, allowEmpty: Boolean, exactDateLength: Int)
Create a new CustomDateEditor instance, using the given DateFormat for parsing and rendering. The "allowEmpty" parameter states if an empty String should be allowed for parsing, i.e. get interpreted as null value. Otherwise, an IllegalArgumentException gets thrown in that case. The "exactDateLength" parameter states that IllegalArgumentException gets thrown if the String does not exactly match the length specified. This is useful because SimpleDateFormat does not enforce strict parsing of the year part, not even with |
open fun getAsText(): String
Format the Date as String, using the specified DateFormat. |
|
open fun setAsText(text: String): Unit
Parse the Date from the given text, using the specified DateFormat. |