Package org.jdesktop.beansbinding
Class ObjectProperty<S>
- java.lang.Object
-
- org.jdesktop.beansbinding.Property<S,S>
-
- org.jdesktop.beansbinding.ObjectProperty<S>
-
- Type Parameters:
S- the type of source object that thisPropertyoperates on and therefore the type of value that it represents
public final class ObjectProperty<S> extends Property<S,S>
An immutable, read-only,Propertyimplementation whosegetValuemethod returns the source object that it is given. This class is useful when you want to configure aBindingto use its source object directly, rather than some property of the source object. For example:new SomeBindingClass(sourceObject, ObjectProperty.create(), targetObject, targetProperty);Explicitly using
ObjectPropertyisn't necessary when creatingBindingsfrom this package or theSwingBindingspackage, as the set of static creation methods include versions that handle this for you.- Author:
- Shannon Hickey
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPropertyStateListener(S source, PropertyStateListener listener)Does nothing; the state of anObjectPropertynever changes so listeners aren't useful.static <S> ObjectProperty<S>create()Creates an instance ofObjectProperty.PropertyStateListener[]getPropertyStateListeners(S source)Returns an empty array; the state of anObjectPropertynever changes so listeners aren't useful.SgetValue(S source)Returns the source object passed to the method.Class<? extends S>getWriteType(S source)ThrowsUnsupportedOperationException;ObjectPropertyis never writeable.booleanisReadable(Object source)Returnstrue;ObjectPropertyis always readable.booleanisWriteable(Object source)Returnsfalse;ObjectPropertyis never writeable.voidremovePropertyStateListener(S source, PropertyStateListener listener)Does nothing; the state of anObjectPropertynever changes so listeners aren't useful.voidsetValue(S source, S value)ThrowsUnsupportedOperationException;ObjectPropertyis never writeable.StringtoString()Returns a string representation of theObjectProperty.
-
-
-
Method Detail
-
create
public static <S> ObjectProperty<S> create()
Creates an instance ofObjectProperty.
-
getWriteType
public Class<? extends S> getWriteType(S source)
ThrowsUnsupportedOperationException;ObjectPropertyis never writeable.- Specified by:
getWriteTypein classProperty<S,S>- Parameters:
source- the source object on which to operate- Returns:
- never returns; always throws
UnsupportedOperationException;ObjectPropertyis never writeable - Throws:
UnsupportedOperationException- always;ObjectPropertyis never writeable- See Also:
isWriteable(java.lang.Object)
-
getValue
public S getValue(S source)
Returns the source object passed to the method.- Specified by:
getValuein classProperty<S,S>- Parameters:
source- the source object on which to operate- Returns:
- the value of the
sourceargument - See Also:
isReadable(java.lang.Object)
-
setValue
public void setValue(S source, S value)
ThrowsUnsupportedOperationException;ObjectPropertyis never writeable.- Specified by:
setValuein classProperty<S,S>- Parameters:
source- the source object on which to operatevalue- the new value for theProperty- Throws:
UnsupportedOperationException- always;ObjectPropertyis never writeable- See Also:
isWriteable(java.lang.Object),getWriteType(S)
-
isReadable
public boolean isReadable(Object source)
Returnstrue;ObjectPropertyis always readable.- Specified by:
isReadablein classProperty<S,S>- Parameters:
source- the source object on which to operate- Returns:
true;ObjectPropertis always readable- See Also:
isWriteable(java.lang.Object)
-
isWriteable
public boolean isWriteable(Object source)
Returnsfalse;ObjectPropertyis never writeable.- Specified by:
isWriteablein classProperty<S,S>- Parameters:
source- the source object on which to operate- Returns:
false;ObjectPropertis never writeable- See Also:
isReadable(java.lang.Object)
-
toString
public String toString()
Returns a string representation of theObjectProperty. This method is intended to be used for debugging purposes only, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not benull.
-
addPropertyStateListener
public void addPropertyStateListener(S source, PropertyStateListener listener)
Does nothing; the state of anObjectPropertynever changes so listeners aren't useful.- Specified by:
addPropertyStateListenerin classProperty<S,S>- Parameters:
source- the source object on which to operatelistener- the listener to be notified
-
removePropertyStateListener
public void removePropertyStateListener(S source, PropertyStateListener listener)
Does nothing; the state of anObjectPropertynever changes so listeners aren't useful.- Specified by:
removePropertyStateListenerin classProperty<S,S>- Parameters:
source- the source object on which to operatelistener- the listener to be removed- See Also:
addPropertyStateListener(S, org.jdesktop.beansbinding.PropertyStateListener)
-
getPropertyStateListeners
public PropertyStateListener[] getPropertyStateListeners(S source)
Returns an empty array; the state of anObjectPropertynever changes so listeners aren't useful.- Specified by:
getPropertyStateListenersin classProperty<S,S>- Parameters:
source- the source object on which to operate- Returns:
- an empty array
- See Also:
addPropertyStateListener(S, org.jdesktop.beansbinding.PropertyStateListener)
-
-