|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.beans.PropertyEditorSupport org.springframework.beans.propertyeditors.StringArrayPropertyEditor
public class StringArrayPropertyEditor
Custom PropertyEditor
for String arrays.
Strings must be in CSV format, with a customizable separator. By default values in the result are trimmed of whitespace.
StringUtils.delimitedListToStringArray(java.lang.String, java.lang.String)
,
StringUtils.arrayToDelimitedString(java.lang.Object[], java.lang.String)
Field Summary | |
---|---|
private java.lang.String |
charsToDelete
|
static java.lang.String |
DEFAULT_SEPARATOR
Default separator for splitting a String: a comma (",") |
private boolean |
emptyArrayAsNull
|
private java.lang.String |
separator
|
private boolean |
trimValues
|
Constructor Summary | |
---|---|
StringArrayPropertyEditor()
Create a new StringArrayPropertyEditor with the default separator (a comma). |
|
StringArrayPropertyEditor(java.lang.String separator)
Create a new StringArrayPropertyEditor with the given separator. |
|
StringArrayPropertyEditor(java.lang.String separator,
boolean emptyArrayAsNull)
Create a new StringArrayPropertyEditor with the given separator. |
|
StringArrayPropertyEditor(java.lang.String separator,
boolean emptyArrayAsNull,
boolean trimValues)
Create a new StringArrayPropertyEditor with the given separator. |
|
StringArrayPropertyEditor(java.lang.String separator,
java.lang.String charsToDelete,
boolean emptyArrayAsNull)
Create a new StringArrayPropertyEditor with the given separator. |
|
StringArrayPropertyEditor(java.lang.String separator,
java.lang.String charsToDelete,
boolean emptyArrayAsNull,
boolean trimValues)
Create a new StringArrayPropertyEditor with the given separator. |
Method Summary | |
---|---|
java.lang.String |
getAsText()
|
void |
setAsText(java.lang.String text)
|
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 |
Field Detail |
---|
public static final java.lang.String DEFAULT_SEPARATOR
private final java.lang.String separator
private final java.lang.String charsToDelete
private final boolean emptyArrayAsNull
private final boolean trimValues
Constructor Detail |
---|
public StringArrayPropertyEditor()
An empty text (without elements) will be turned into an empty array.
public StringArrayPropertyEditor(java.lang.String separator)
An empty text (without elements) will be turned into an empty array.
separator
- the separator to use for splitting a String
public StringArrayPropertyEditor(java.lang.String separator, boolean emptyArrayAsNull)
separator
- the separator to use for splitting a String
emptyArrayAsNull
- true
if an empty String array
is to be transformed into null
public StringArrayPropertyEditor(java.lang.String separator, boolean emptyArrayAsNull, boolean trimValues)
separator
- the separator to use for splitting a String
emptyArrayAsNull
- true
if an empty String array
is to be transformed into null
trimValues
- true
if the values in the parsed arrays
are to be be trimmed of whitespace (default is true).public StringArrayPropertyEditor(java.lang.String separator, java.lang.String charsToDelete, boolean emptyArrayAsNull)
separator
- the separator to use for splitting a String
charsToDelete
- 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.emptyArrayAsNull
- true
if an empty String array
is to be transformed into null
public StringArrayPropertyEditor(java.lang.String separator, java.lang.String charsToDelete, boolean emptyArrayAsNull, boolean trimValues)
separator
- the separator to use for splitting a String
charsToDelete
- 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.emptyArrayAsNull
- true
if an empty String array
is to be transformed into null
trimValues
- true
if the values in the parsed arrays
are to be be trimmed of whitespace (default is true).Method Detail |
---|
public void setAsText(java.lang.String text) throws java.lang.IllegalArgumentException
setAsText
in interface java.beans.PropertyEditor
setAsText
in class java.beans.PropertyEditorSupport
java.lang.IllegalArgumentException
public java.lang.String getAsText()
getAsText
in interface java.beans.PropertyEditor
getAsText
in class java.beans.PropertyEditorSupport
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |