Package org.jboss.common.beans.property
Class PropertyEditorSupport<T>
- java.lang.Object
-
- java.beans.PropertyEditorSupport
-
- org.jboss.common.beans.property.PropertyEditorSupport<T>
-
- All Implemented Interfaces:
java.beans.PropertyEditor,PropertyEditor<T>
- Direct Known Subclasses:
AtomicBooleanEditor,AtomicIntegerEditor,AtomicLongEditor,BigDecimalEditor,BigIntegerEditor,BooleanEditor,ByteEditor,CharacterEditor,ClassEditor,DateEditor,DoubleEditor,FileEditor,FloatEditor,GenericArrayPropertyEditor,InetAddressEditor,IntegerEditor,LocaleEditor,LongEditor,ObjectNameEditor,PropertiesEditor,ShortEditor,StringEditor,URIEditor,URLEditor,XMLEditorSupport
public abstract class PropertyEditorSupport<T> extends java.beans.PropertyEditorSupport implements PropertyEditor<T>
-
-
Constructor Summary
Constructors Constructor Description PropertyEditorSupport(java.lang.Class<T> type)Creates PropertyEditorSupport instance.PropertyEditorSupport(java.lang.Class<T> type, java.lang.Object source)Creates PropertyEditorSupport instance.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddPropertyChangeListener(java.beans.PropertyChangeListener listener)voidaddPropertyChangeListener(PropertyChangeListener<T> listener)Adds a listener for the value change.voidfirePropertyChange(T oldValue, T newValue)java.lang.StringgetAsText()Gets the property value as text.protected java.lang.Class<T>getType()TgetValue()Gets the property value.voidremovePropertyChangeListener(java.beans.PropertyChangeListener listener)voidremovePropertyChangeListener(PropertyChangeListener<T> listener)Removes a listener for the value change.abstract voidsetAsText(java.lang.String text)Set the property value by parsing a given String.voidsetValue(java.lang.Object value)Set (or change) the object that is to be edited.
-
-
-
Constructor Detail
-
PropertyEditorSupport
public PropertyEditorSupport(java.lang.Class<T> type)
Creates PropertyEditorSupport instance. Requires T class to enforce runtime type checks.
-
PropertyEditorSupport
public PropertyEditorSupport(java.lang.Class<T> type, java.lang.Object source)
Creates PropertyEditorSupport instance. Requires T class to enforce runtime type checks and a source.
-
-
Method Detail
-
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener<T> listener)
Description copied from interface:PropertyEditorAdds a listener for the value change. When the property editor changes its value it should fire aPropertyChangeEventon all registeredPropertyChangeListeners, specifying thenullvalue for the property name and itself as the source.- Specified by:
addPropertyChangeListenerin interfacePropertyEditor<T>- Parameters:
listener- thePropertyChangeListenerto add
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
- Specified by:
addPropertyChangeListenerin interfacejava.beans.PropertyEditor- Overrides:
addPropertyChangeListenerin classjava.beans.PropertyEditorSupport
-
getAsText
public java.lang.String getAsText()
Description copied from interface:PropertyEditorGets the property value as text.- Specified by:
getAsTextin interfacejava.beans.PropertyEditor- Specified by:
getAsTextin interfacePropertyEditor<T>- Overrides:
getAsTextin classjava.beans.PropertyEditorSupport- 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().
-
getValue
public T getValue()
Description copied from interface:PropertyEditorGets the property value.- Specified by:
getValuein interfacejava.beans.PropertyEditor- Specified by:
getValuein interfacePropertyEditor<T>- Overrides:
getValuein classjava.beans.PropertyEditorSupport- Returns:
- The value of the property. Primitive types such as "int" will be wrapped as the corresponding object type such as "java.lang.Integer".
-
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener<T> listener)
Description copied from interface:PropertyEditorRemoves a listener for the value change.- Specified by:
removePropertyChangeListenerin interfacePropertyEditor<T>- Parameters:
listener- thePropertyChangeListenerto remove
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
- Specified by:
removePropertyChangeListenerin interfacejava.beans.PropertyEditor- Overrides:
removePropertyChangeListenerin classjava.beans.PropertyEditorSupport
-
setValue
public void setValue(java.lang.Object value)
Description copied from interface:PropertyEditorSet (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".- Specified by:
setValuein interfacejava.beans.PropertyEditor- Specified by:
setValuein interfacePropertyEditor<T>- Overrides:
setValuein classjava.beans.PropertyEditorSupport- 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.
-
getType
protected java.lang.Class<T> getType()
-
setAsText
public abstract void setAsText(java.lang.String text) throws java.lang.IllegalArgumentExceptionDescription copied from interface:PropertyEditorSet 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:
setAsTextin interfacejava.beans.PropertyEditor- Specified by:
setAsTextin interfacePropertyEditor<T>- Overrides:
setAsTextin classjava.beans.PropertyEditorSupport- Parameters:
text- The string to be parsed.- Throws:
java.lang.IllegalArgumentException
-
-