Package org.jboss.common.beans.property
Class GenericArrayPropertyEditor<T>
- java.lang.Object
-
- java.beans.PropertyEditorSupport
-
- org.jboss.common.beans.property.PropertyEditorSupport<T>
-
- org.jboss.common.beans.property.GenericArrayPropertyEditor<T>
-
- All Implemented Interfaces:
java.beans.PropertyEditor
,PropertyEditor<T>
- Direct Known Subclasses:
BooleanArrayEditor
,ByteArrayEditor
,CharacterArrayEditor
,ClassArrayEditor
,DoubleArrayEditor
,FloatArrayEditor
,InetAddressArrayEditor
,IntegerArrayEditor
,LongArrayEditor
,ShortArrayEditor
,StringArrayEditor
public class GenericArrayPropertyEditor<T> extends PropertyEditorSupport<T>
Generic array support editor. Depending on type of array it performs all required operations to transform from/to text. It requires array cell property editor to be present - ProperyEditorManager.findEditor(arrayClass.getComponentType()) != null
This class is not registered as property editor inPropertyEditorManager
. It is created at runtime in following condition:- Any of
PropertyEditors
fetch methods is passed array type for which there is no editor -
PropertyEditors
orPropertyEditorManager
can access editor forClass.getComponentType()
.
-
-
Constructor Summary
Constructors Constructor Description GenericArrayPropertyEditor(java.lang.Class<T> initType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
encode(java.lang.String[] v)
java.lang.String
getAsText()
Gets the property value as text.protected java.lang.Class<?>
getCellType()
protected ArrayTokenizer
getTokenizer()
void
setAsText(java.lang.String text)
Set the property value by parsing a given String.protected java.lang.String[]
tokenize(java.lang.String text)
-
Methods inherited from class org.jboss.common.beans.property.PropertyEditorSupport
addPropertyChangeListener, addPropertyChangeListener, firePropertyChange, getType, getValue, removePropertyChangeListener, removePropertyChangeListener, setValue
-
-
-
-
Constructor Detail
-
GenericArrayPropertyEditor
public GenericArrayPropertyEditor(java.lang.Class<T> initType)
- Parameters:
type
-
-
-
Method Detail
-
setAsText
public void setAsText(java.lang.String text) throws java.lang.IllegalArgumentException
Description copied from interface:PropertyEditor
Set the property value by parsing a given String. May raise java.lang.IllegalArgumentException if either the String is badly formatted or if this kind of property can't be expressed as text.- Specified by:
setAsText
in interfacejava.beans.PropertyEditor
- Specified by:
setAsText
in interfacePropertyEditor<T>
- Specified by:
setAsText
in classPropertyEditorSupport<T>
- Parameters:
text
- The string to be parsed.- Throws:
java.lang.IllegalArgumentException
-
getAsText
public java.lang.String getAsText()
Description copied from interface:PropertyEditor
Gets the property value as text.- Specified by:
getAsText
in interfacejava.beans.PropertyEditor
- Specified by:
getAsText
in interfacePropertyEditor<T>
- Overrides:
getAsText
in classPropertyEditorSupport<T>
- Returns:
- The property value as a human editable string.
Returns null if the value can't be expressed as an editable string.
If a non-null value is returned, then the PropertyEditor should be prepared to parse that string back in setAsText().
-
tokenize
protected java.lang.String[] tokenize(java.lang.String text)
-
encode
protected java.lang.String encode(java.lang.String[] v)
-
getCellType
protected java.lang.Class<?> getCellType()
-
getTokenizer
protected ArrayTokenizer getTokenizer()
-
-