public class

StringArrayPropertyEditor

extends PropertyEditorSupport
java.lang.Object
   ↳ java.beans.PropertyEditorSupport
     ↳ org.springframework.beans.propertyeditors.StringArrayPropertyEditor

Class Overview

Custom java.beans.PropertyEditor for String arrays.

Strings must be in CSV format, with a customizable separator. By default values in the result are trimmed of whitespace.

Summary

Constants
String DEFAULT_SEPARATOR Default separator for splitting a String: a comma (",")
Public Constructors
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.
Public Methods
String getAsText()
void setAsText(String text)
[Expand]
Inherited Methods
From class java.beans.PropertyEditorSupport
From class java.lang.Object
From interface java.beans.PropertyEditor

Constants

public static final String DEFAULT_SEPARATOR

Also: SpringBeans

Default separator for splitting a String: a comma (",")

Constant Value: ","

Public Constructors

public StringArrayPropertyEditor ()

Also: SpringBeans

Create a new StringArrayPropertyEditor with the default separator (a comma).

An empty text (without elements) will be turned into an empty array.

public StringArrayPropertyEditor (String separator)

Also: SpringBeans

Create a new StringArrayPropertyEditor with 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

public StringArrayPropertyEditor (String separator, boolean emptyArrayAsNull)

Also: SpringBeans

Create a new StringArrayPropertyEditor with the given separator.

Parameters
separator the separator to use for splitting a String
emptyArrayAsNull true if an empty String array is to be transformed into null

public StringArrayPropertyEditor (String separator, boolean emptyArrayAsNull, boolean trimValues)

Also: SpringBeans

Create a new StringArrayPropertyEditor with the given separator.

Parameters
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 (String separator, String charsToDelete, boolean emptyArrayAsNull)

Also: SpringBeans

Create a new StringArrayPropertyEditor with 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 true if an empty String array is to be transformed into null

public StringArrayPropertyEditor (String separator, String charsToDelete, boolean emptyArrayAsNull, boolean trimValues)

Also: SpringBeans

Create a new StringArrayPropertyEditor with 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 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 Methods

public String getAsText ()

public void setAsText (String text)