JBoss Common Beans 1.1.0.Final-redhat-1

org.jboss.common.beans.property
Interface PropertyEditor<T>


public interface PropertyEditor<T>

Author:
Carlo de Wolf

Method Summary
 void addPropertyChangeListener(PropertyChangeListener<T> listener)
          Adds a listener for the value change.
 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(String text)
          Set the property value by parsing a given String.
 void setValue(Object value)
          Set (or change) the object that is to be edited.
 

Method Detail

setValue

void setValue(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

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(String text)
               throws 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:
IllegalArgumentException

addPropertyChangeListener

void addPropertyChangeListener(PropertyChangeListener<T> listener)
Adds a listener for the value change. When the property editor changes its value it should fire a PropertyChangeEvent on all registered PropertyChangeListeners, specifying the null value for the property name and itself as the source.

Parameters:
listener - the PropertyChangeListener to add

removePropertyChangeListener

void removePropertyChangeListener(PropertyChangeListener<T> listener)
Removes a listener for the value change.

Parameters:
listener - the PropertyChangeListener to remove

JBoss Common Beans 1.1.0.Final-redhat-1

Copyright © 2013 JBoss by Red Hat. All Rights Reserved.