public class StringArrayPropertyEditor extends PropertyEditorSupport
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)| 限定符和类型 | 字段和说明 |
|---|---|
static String |
DEFAULT_SEPARATOR
Default separator for splitting a String: a comma (",")
|
| 构造器和说明 |
|---|
StringArrayPropertyEditor()
Create a new StringArrayPropertyEditor with the default separator
(a comma).
|
StringArrayPropertyEditor(String separator)
Create a new StringArrayPropertyEditor with the given separator.
|
StringArrayPropertyEditor(String separator,
boolean emptyArrayAsNull)
Create a new StringArrayPropertyEditor with the given separator.
|
StringArrayPropertyEditor(String separator,
boolean emptyArrayAsNull,
boolean trimValues)
Create a new StringArrayPropertyEditor with the given separator.
|
StringArrayPropertyEditor(String separator,
String charsToDelete,
boolean emptyArrayAsNull)
Create a new StringArrayPropertyEditor with the given separator.
|
StringArrayPropertyEditor(String separator,
String charsToDelete,
boolean emptyArrayAsNull,
boolean trimValues)
Create a new StringArrayPropertyEditor with the given separator.
|
| 限定符和类型 | 方法和说明 |
|---|---|
String |
getAsText() |
void |
setAsText(String text) |
public StringArrayPropertyEditor()
An empty text (without elements) will be turned into an empty array.
public StringArrayPropertyEditor(String separator)
An empty text (without elements) will be turned into an empty array.
separator - the separator to use for splitting a Stringpublic StringArrayPropertyEditor(String separator, boolean emptyArrayAsNull)
separator - the separator to use for splitting a StringemptyArrayAsNull - true if an empty String array
is to be transformed into nullpublic StringArrayPropertyEditor(String separator, boolean emptyArrayAsNull, boolean trimValues)
separator - the separator to use for splitting a StringemptyArrayAsNull - true if an empty String array
is to be transformed into nulltrimValues - true if the values in the parsed arrays
are to be trimmed of whitespace (default is true).public StringArrayPropertyEditor(String separator, @Nullable String charsToDelete, boolean emptyArrayAsNull)
separator - the separator to use for splitting a StringcharsToDelete - 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 nullpublic StringArrayPropertyEditor(String separator, @Nullable String charsToDelete, boolean emptyArrayAsNull, boolean trimValues)
separator - the separator to use for splitting a StringcharsToDelete - 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 nulltrimValues - true if the values in the parsed arrays
are to be trimmed of whitespace (default is true).public void setAsText(String text) throws IllegalArgumentException
setAsText 在接口中 PropertyEditorsetAsText 在类中 PropertyEditorSupportIllegalArgumentExceptionpublic String getAsText()
getAsText 在接口中 PropertyEditorgetAsText 在类中 PropertyEditorSupport