Class StringArrayPropertyEditor
java.lang.Object
java.beans.PropertyEditorSupport
org.springframework.beans.propertyeditors.StringArrayPropertyEditor
- All Implemented Interfaces:
 PropertyEditor
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.
- Author:
 - Rod Johnson, Juergen Hoeller, Dave Syer
 - See Also:
 
- 
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDefault separator for splitting a String: a comma (","). - 
Constructor Summary
ConstructorsConstructorDescriptionCreate a newStringArrayPropertyEditorwith the default separator (a comma).StringArrayPropertyEditor(String separator) Create a newStringArrayPropertyEditorwith the given separator.StringArrayPropertyEditor(String separator, boolean emptyArrayAsNull) Create a newStringArrayPropertyEditorwith the given separator.StringArrayPropertyEditor(String separator, boolean emptyArrayAsNull, boolean trimValues) Create a newStringArrayPropertyEditorwith the given separator.StringArrayPropertyEditor(String separator, String charsToDelete, boolean emptyArrayAsNull) Create a newStringArrayPropertyEditorwith the given separator.StringArrayPropertyEditor(String separator, String charsToDelete, boolean emptyArrayAsNull, boolean trimValues) Create a newStringArrayPropertyEditorwith the given separator. - 
Method Summary
Methods inherited from class java.beans.PropertyEditorSupport
addPropertyChangeListener, firePropertyChange, getCustomEditor, getJavaInitializationString, getSource, getTags, getValue, isPaintable, paintValue, removePropertyChangeListener, setSource, setValue, supportsCustomEditor 
- 
Field Details
- 
DEFAULT_SEPARATOR
Default separator for splitting a String: a comma (",").- See Also:
 
 
 - 
 - 
Constructor Details
- 
StringArrayPropertyEditor
public StringArrayPropertyEditor()Create a newStringArrayPropertyEditorwith the default separator (a comma).An empty text (without elements) will be turned into an empty array.
 - 
StringArrayPropertyEditor
Create a newStringArrayPropertyEditorwith the given separator.An empty text (without elements) will be turned into an empty array.
- Parameters:
 separator- the separator to use for splitting aString
 - 
StringArrayPropertyEditor
Create a newStringArrayPropertyEditorwith the given separator.- Parameters:
 separator- the separator to use for splitting aStringemptyArrayAsNull-trueif an empty String array is to be transformed intonull
 - 
StringArrayPropertyEditor
Create a newStringArrayPropertyEditorwith the given separator.- Parameters:
 separator- the separator to use for splitting aStringemptyArrayAsNull-trueif an empty String array is to be transformed intonulltrimValues-trueif the values in the parsed arrays are to be trimmed of whitespace (default istrue)
 - 
StringArrayPropertyEditor
public StringArrayPropertyEditor(String separator, @Nullable String charsToDelete, boolean emptyArrayAsNull) Create a newStringArrayPropertyEditorwith the given separator.- Parameters:
 separator- the separator to use for splitting aStringcharsToDelete- 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-trueif an empty String array is to be transformed intonull
 - 
StringArrayPropertyEditor
public StringArrayPropertyEditor(String separator, @Nullable String charsToDelete, boolean emptyArrayAsNull, boolean trimValues) Create a newStringArrayPropertyEditorwith the given separator.- Parameters:
 separator- the separator to use for splitting aStringcharsToDelete- 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-trueif an empty String array is to be transformed intonulltrimValues-trueif the values in the parsed arrays are to be trimmed of whitespace (default istrue)
 
 - 
 - 
Method Details
- 
setAsText
- Specified by:
 setAsTextin interfacePropertyEditor- Overrides:
 setAsTextin classPropertyEditorSupport- Throws:
 IllegalArgumentException
 - 
getAsText
- Specified by:
 getAsTextin interfacePropertyEditor- Overrides:
 getAsTextin classPropertyEditorSupport
 
 -