Package org.jdesktop.beansbinding
Class Property<S,V>
java.lang.Object
org.jdesktop.beansbinding.Property<S,V>
- Type Parameters:
S- the type of source object that thisPropertyoperates onV- the type of value that thisPropertyrepresents
- Direct Known Subclasses:
ObjectProperty,PropertyHelper
Property defines a uniform way to access the value of a property.
A typical Property implemention allows you to create an immutable
representation of a way to derive some property from a source object.
As such, all methods of this class take a source object as an argument.
A Property implementation may, however, be designed such that the
Property itself is a mutable thing that stores a property value.
In such a case, the Property implementation may ignore the source
object. Property implementations should clearly document their
behavior in this regard.
You can listen for changes in the state of a Property by
registering PropertyStateListeners on the Property.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidaddPropertyStateListener(S source, PropertyStateListener listener) Adds aPropertyStateListenerto be notified when the state of thePropertychanges with respect to the given source.abstract PropertyStateListener[]getPropertyStateListeners(S source) Returns an arry containing the listeners registered for the given source.abstract VReturns the value of thisPropertyfor the given source.getWriteType(S source) Returns the type of object that is suitable for setting as the value of thisPropertyby calls tosetValue.abstract booleanisReadable(S source) Returns whether or not thePropertyis readable for the given source.abstract booleanisWriteable(S source) Returns whether or not thePropertyis writeable for the given source.abstract voidremovePropertyStateListener(S source, PropertyStateListener listener) Removes aPropertyStateListenerfor the given source.abstract voidSets the value of thisPropertyfor the given source.
-
Constructor Details
-
Property
public Property()
-
-
Method Details
-
getWriteType
Returns the type of object that is suitable for setting as the value of thisPropertyby calls tosetValue.- Parameters:
source- the source object on which to operate- Returns:
- the type of object suitable for setting as the value
- Throws:
UnsupportedOperationException- if thePropertyis not writeable for the given source- See Also:
-
getValue
Returns the value of thisPropertyfor the given source.- Parameters:
source- the source object on which to operate- Returns:
- the value of this
Propertyfor the given source - Throws:
UnsupportedOperationException- if thePropertyis not readable for the given source- See Also:
-
setValue
Sets the value of thisPropertyfor the given source.- Parameters:
source- the source object on which to operatevalue- the new value for theProperty- Throws:
UnsupportedOperationException- if thePropertyis not writeable for the given source- See Also:
-
isReadable
Returns whether or not thePropertyis readable for the given source.- Parameters:
source- the source object on which to operate- Returns:
- whether or not the
Propertyis readable for the given source. - See Also:
-
isWriteable
Returns whether or not thePropertyis writeable for the given source.- Parameters:
source- the source object on which to operate- Returns:
- whether or not the
Propertyis writeable for the given source. - See Also:
-
addPropertyStateListener
Adds aPropertyStateListenerto be notified when the state of thePropertychanges with respect to the given source. Does nothing if the listener isnull. If a listener is added more than once, notifications are sent to that listener once for every time that it has been added. The ordering of listener notification is unspecified.- Parameters:
source- the source object on which to operatelistener- the listener to be notified
-
removePropertyStateListener
Removes aPropertyStateListenerfor the given source. Does nothing if the listener isnullor is not one of those registered for this source object. If the listener being removed was registered more than once, only one occurrence of the listener is removed from the list of listeners. The ordering of listener notification is unspecified.- Parameters:
source- the source object on which to operatelistener- the listener to be removed- See Also:
-
getPropertyStateListeners
Returns an arry containing the listeners registered for the given source. Order is undefined. Returns an empty array if there are no listeners.- Parameters:
source- the source object on which to operate- Returns:
- the set of listeners registered for the given source
- See Also:
-