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 SummaryFieldsModifier and TypeFieldDescriptionstatic final StringDefault separator for splitting a String: a comma (",").
- 
Constructor SummaryConstructorsConstructorDescriptionCreate 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 SummaryMethods inherited from class java.beans.PropertyEditorSupportaddPropertyChangeListener, firePropertyChange, getCustomEditor, getJavaInitializationString, getSource, getTags, getValue, isPaintable, paintValue, removePropertyChangeListener, setSource, setValue, supportsCustomEditor
- 
Field Details- 
DEFAULT_SEPARATORDefault separator for splitting a String: a comma (",").- See Also:
 
 
- 
- 
Constructor Details- 
StringArrayPropertyEditorpublic StringArrayPropertyEditor()Create a newStringArrayPropertyEditorwith the default separator (a comma).An empty text (without elements) will be turned into an empty array. 
- 
StringArrayPropertyEditorCreate 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 a- String
 
- 
StringArrayPropertyEditorCreate a newStringArrayPropertyEditorwith the given separator.- Parameters:
- separator- the separator to use for splitting a- String
- emptyArrayAsNull-- trueif an empty String array is to be transformed into- null
 
- 
StringArrayPropertyEditorCreate a newStringArrayPropertyEditorwith the given separator.- Parameters:
- separator- the separator to use for splitting a- String
- emptyArrayAsNull-- trueif an empty String array is to be transformed into- null
- trimValues-- trueif the values in the parsed arrays are to be trimmed of whitespace (default is- true)
 
- 
StringArrayPropertyEditorpublic StringArrayPropertyEditor(String separator, @Nullable String charsToDelete, boolean emptyArrayAsNull) Create a newStringArrayPropertyEditorwith the given separator.- Parameters:
- 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-- trueif an empty String array is to be transformed into- null
 
- 
StringArrayPropertyEditorpublic StringArrayPropertyEditor(String separator, @Nullable String charsToDelete, boolean emptyArrayAsNull, boolean trimValues) Create a newStringArrayPropertyEditorwith the given separator.- Parameters:
- 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-- trueif an empty String array is to be transformed into- null
- trimValues-- trueif the values in the parsed arrays are to be trimmed of whitespace (default is- true)
 
 
- 
- 
Method Details- 
setAsText- Specified by:
- setAsTextin interface- PropertyEditor
- Overrides:
- setAsTextin class- PropertyEditorSupport
- Throws:
- IllegalArgumentException
 
- 
getAsText- Specified by:
- getAsTextin interface- PropertyEditor
- Overrides:
- getAsTextin class- PropertyEditorSupport
 
 
-