Package org.jboss.common.beans.property
Interface PropertyEditor<T>
-
- All Known Implementing Classes:
AtomicBooleanEditor
,AtomicIntegerEditor
,AtomicLongEditor
,BigDecimalEditor
,BigIntegerEditor
,BooleanArrayEditor
,BooleanEditor
,ByteArrayEditor
,ByteEditor
,CharacterArrayEditor
,CharacterEditor
,ClassArrayEditor
,ClassEditor
,DateEditor
,DocumentEditor
,DoubleArrayEditor
,DoubleEditor
,ElementEditor
,FileEditor
,FloatArrayEditor
,FloatEditor
,GenericArrayPropertyEditor
,InetAddressArrayEditor
,InetAddressEditor
,IntegerArrayEditor
,IntegerEditor
,LocaleEditor
,LongArrayEditor
,LongEditor
,ObjectNameEditor
,PropertiesEditor
,PropertyEditorSupport
,ShortArrayEditor
,ShortEditor
,StringArrayEditor
,StringEditor
,URIEditor
,URLEditor
,XMLEditorSupport
public interface PropertyEditor<T>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addPropertyChangeListener(PropertyChangeListener<T> listener)
Adds a listener for the value change.java.lang.String
getAsText()
Gets the property value as text.T
getValue()
Gets the property value.void
removePropertyChangeListener(PropertyChangeListener<T> listener)
Removes a listener for the value change.void
setAsText(java.lang.String text)
Set the property value by parsing a given String.void
setValue(java.lang.Object value)
Set (or change) the object that is to be edited.
-
-
-
Method Detail
-
setValue
void setValue(java.lang.Object value)
Set (or change) the object that is to be edited. Primitive types such as "int" must be wrapped as the corresponding object type such as "java.lang.Integer".- Parameters:
value
- The new target object to be edited. Note that this object should not be modified by the PropertyEditor, rather the PropertyEditor should create a new object to hold any modified value.
-
getValue
T getValue()
Gets the property value.- Returns:
- The value of the property. Primitive types such as "int" will be wrapped as the corresponding object type such as "java.lang.Integer".
-
getAsText
java.lang.String getAsText()
Gets the property value as text.- 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().
-
setAsText
void setAsText(java.lang.String text) throws java.lang.IllegalArgumentException
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.- Parameters:
text
- The string to be parsed.- Throws:
java.lang.IllegalArgumentException
-
addPropertyChangeListener
void addPropertyChangeListener(PropertyChangeListener<T> listener)
Adds a listener for the value change. When the property editor changes its value it should fire aPropertyChangeEvent
on all registeredPropertyChangeListener
s, specifying thenull
value for the property name and itself as the source.- Parameters:
listener
- thePropertyChangeListener
to add
-
removePropertyChangeListener
void removePropertyChangeListener(PropertyChangeListener<T> listener)
Removes a listener for the value change.- Parameters:
listener
- thePropertyChangeListener
to remove
-
-