|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.beans.PropertyEditorSupport
org.riotfamily.common.beans.propertyeditors.SqlDateEditor
public class SqlDateEditor
PropertyEditor for java.sql.Date
, supporting a custom
java.text.DateFormat
.
Based on Spring's CustomDateEditor
Constructor Summary | |
---|---|
SqlDateEditor()
Create a new SqlDateEditor for dates matching the yyyy-MM-dd
pattern. |
|
SqlDateEditor(DateFormat dateFormat,
boolean allowEmpty)
Create a new SqlDateEditor instance, using the given DateFormat for parsing and rendering. |
|
SqlDateEditor(DateFormat dateFormat,
boolean allowEmpty,
int exactDateLength)
Create a new SqlDateEditor instance, using the given DateFormat for parsing and rendering. |
Method Summary | |
---|---|
String |
getAsText()
Format the Date as String, using the specified DateFormat. |
void |
setAsText(String text)
Parse the Date from the given text, using the specified DateFormat. |
Methods inherited from class java.beans.PropertyEditorSupport |
---|
addPropertyChangeListener, firePropertyChange, getCustomEditor, getJavaInitializationString, getSource, getTags, getValue, isPaintable, paintValue, removePropertyChangeListener, setSource, setValue, supportsCustomEditor |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SqlDateEditor()
yyyy-MM-dd
pattern.
public SqlDateEditor(DateFormat dateFormat, boolean allowEmpty)
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.
dateFormat
- DateFormat to use for parsing and renderingallowEmpty
- if empty strings should be allowedpublic SqlDateEditor(DateFormat dateFormat, boolean allowEmpty, int exactDateLength)
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 setLenient(false)
. Without an "exactDateLength"
specified, the "01/01/05" would get parsed to "01/01/0005".
dateFormat
- DateFormat to use for parsing and renderingallowEmpty
- if empty strings should be allowedexactDateLength
- the exact expected length of the date StringMethod Detail |
---|
public void setAsText(String text) throws IllegalArgumentException
setAsText
in interface PropertyEditor
setAsText
in class PropertyEditorSupport
IllegalArgumentException
public String getAsText()
getAsText
in interface PropertyEditor
getAsText
in class PropertyEditorSupport
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |