org.jdesktop.beansbinding
S
- the type of source object that this Property
operates on
and therefore the type of value that it representspublic final class ObjectProperty<S> extends Property<S,S>
Property
implementation whose getValue
method returns the source object that it is given. This class is useful when
you want to configure a Binding
to use its source object directly,
rather than some property of the source object. For example:
new SomeBindingClass(sourceObject, ObjectProperty.create(), targetObject, targetProperty);
Explicitly using ObjectProperty
isn't necessary when creating Bindings
from this package or the SwingBindings
package, as the set of static creation
methods include versions that handle this for you.
Modifier and Type | Method and Description |
---|---|
void |
addPropertyStateListener(S source,
PropertyStateListener listener)
Does nothing; the state of an
ObjectProperty never changes so
listeners aren't useful. |
static <S> ObjectProperty<S> |
create()
Creates an instance of
ObjectProperty . |
PropertyStateListener[] |
getPropertyStateListeners(S source)
Returns an empty array; the state of an
ObjectProperty never changes
so listeners aren't useful. |
S |
getValue(S source)
Returns the source object passed to the method.
|
java.lang.Class<? extends S> |
getWriteType(S source)
Throws
UnsupportedOperationException ; ObjectProperty is never writeable. |
boolean |
isReadable(java.lang.Object source)
Returns
true ; ObjectProperty is always readable. |
boolean |
isWriteable(java.lang.Object source)
Returns
false ; ObjectProperty is never writeable. |
void |
removePropertyStateListener(S source,
PropertyStateListener listener)
Does nothing; the state of an
ObjectProperty never changes so
listeners aren't useful. |
void |
setValue(S source,
S value)
Throws
UnsupportedOperationException ; ObjectProperty is never writeable. |
java.lang.String |
toString()
Returns a string representation of the
ObjectProperty . |
public static <S> ObjectProperty<S> create()
ObjectProperty
.public java.lang.Class<? extends S> getWriteType(S source)
UnsupportedOperationException
; ObjectProperty
is never writeable.getWriteType
in class Property<S,S>
source
- the source object on which to operateUnsupportedOperationException
; ObjectProperty
is never writeablejava.lang.UnsupportedOperationException
- always; ObjectProperty
is never writeableisWriteable(java.lang.Object)
public S getValue(S source)
getValue
in class Property<S,S>
source
- the source object on which to operatesource
argumentisReadable(java.lang.Object)
public void setValue(S source, S value)
UnsupportedOperationException
; ObjectProperty
is never writeable.setValue
in class Property<S,S>
source
- the source object on which to operatevalue
- the new value for the Property
java.lang.UnsupportedOperationException
- always; ObjectProperty
is never writeableisWriteable(java.lang.Object)
,
getWriteType(S)
public boolean isReadable(java.lang.Object source)
true
; ObjectProperty
is always readable.isReadable
in class Property<S,S>
source
- the source object on which to operatetrue
; ObjectPropert
is always readableisWriteable(java.lang.Object)
public boolean isWriteable(java.lang.Object source)
false
; ObjectProperty
is never writeable.isWriteable
in class Property<S,S>
source
- the source object on which to operatefalse
; ObjectPropert
is never writeableisReadable(java.lang.Object)
public java.lang.String toString()
ObjectProperty
. 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
be null
.toString
in class java.lang.Object
ObjectProperty
public void addPropertyStateListener(S source, PropertyStateListener listener)
ObjectProperty
never changes so
listeners aren't useful.addPropertyStateListener
in class Property<S,S>
source
- the source object on which to operatelistener
- the listener to be notifiedpublic void removePropertyStateListener(S source, PropertyStateListener listener)
ObjectProperty
never changes so
listeners aren't useful.removePropertyStateListener
in class Property<S,S>
source
- the source object on which to operatelistener
- the listener to be removedaddPropertyStateListener(S, org.jdesktop.beansbinding.PropertyStateListener)
public PropertyStateListener[] getPropertyStateListeners(S source)
ObjectProperty
never changes
so listeners aren't useful.getPropertyStateListeners
in class Property<S,S>
source
- the source object on which to operateaddPropertyStateListener(S, org.jdesktop.beansbinding.PropertyStateListener)