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 thisProperty
operates on and therefore the type of value that it represents
public final class ObjectProperty<S> extends Property<S,S>
An immutable, read-only,Property
implementation whosegetValue
method returns the source object that it is given. This class is useful when you want to configure aBinding
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 creatingBindings
from this package or theSwingBindings
package, as the set of static creation methods include versions that handle this for you.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPropertyStateListener(S source, PropertyStateListener listener)
Does nothing; the state of anObjectProperty
never 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 anObjectProperty
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)
ThrowsUnsupportedOperationException
;ObjectProperty
is never writeable.boolean
isReadable(java.lang.Object source)
Returnstrue
;ObjectProperty
is always readable.boolean
isWriteable(java.lang.Object source)
Returnsfalse
;ObjectProperty
is never writeable.void
removePropertyStateListener(S source, PropertyStateListener listener)
Does nothing; the state of anObjectProperty
never changes so listeners aren't useful.void
setValue(S source, S value)
ThrowsUnsupportedOperationException
;ObjectProperty
is never writeable.java.lang.String
toString()
Returns a string representation of theObjectProperty
.
-
-
-
Method Detail
-
create
public static <S> ObjectProperty<S> create()
Creates an instance ofObjectProperty
.
-
getWriteType
public java.lang.Class<? extends S> getWriteType(S source)
ThrowsUnsupportedOperationException
;ObjectProperty
is never writeable.- Specified by:
getWriteType
in classProperty<S,S>
- Parameters:
source
- the source object on which to operate- Returns:
- never returns; always throws
UnsupportedOperationException
;ObjectProperty
is never writeable - Throws:
java.lang.UnsupportedOperationException
- always;ObjectProperty
is never writeable- See Also:
isWriteable(java.lang.Object)
-
getValue
public S getValue(S source)
Returns the source object passed to the method.- Specified by:
getValue
in classProperty<S,S>
- Parameters:
source
- the source object on which to operate- Returns:
- the value of the
source
argument - See Also:
isReadable(java.lang.Object)
-
setValue
public void setValue(S source, S value)
ThrowsUnsupportedOperationException
;ObjectProperty
is never writeable.- Specified by:
setValue
in classProperty<S,S>
- Parameters:
source
- the source object on which to operatevalue
- the new value for theProperty
- Throws:
java.lang.UnsupportedOperationException
- always;ObjectProperty
is never writeable- See Also:
isWriteable(java.lang.Object)
,getWriteType(S)
-
isReadable
public boolean isReadable(java.lang.Object source)
Returnstrue
;ObjectProperty
is always readable.- Specified by:
isReadable
in classProperty<S,S>
- Parameters:
source
- the source object on which to operate- Returns:
true
;ObjectPropert
is always readable- See Also:
isWriteable(java.lang.Object)
-
isWriteable
public boolean isWriteable(java.lang.Object source)
Returnsfalse
;ObjectProperty
is never writeable.- Specified by:
isWriteable
in classProperty<S,S>
- Parameters:
source
- the source object on which to operate- Returns:
false
;ObjectPropert
is never writeable- See Also:
isReadable(java.lang.Object)
-
toString
public java.lang.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
.- Overrides:
toString
in classjava.lang.Object
- Returns:
- a string representation of this
ObjectProperty
-
addPropertyStateListener
public void addPropertyStateListener(S source, PropertyStateListener listener)
Does nothing; the state of anObjectProperty
never changes so listeners aren't useful.- Specified by:
addPropertyStateListener
in 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 anObjectProperty
never changes so listeners aren't useful.- Specified by:
removePropertyStateListener
in 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 anObjectProperty
never changes so listeners aren't useful.- Specified by:
getPropertyStateListeners
in classProperty<S,S>
- Parameters:
source
- the source object on which to operate- Returns:
- an empty array
- See Also:
addPropertyStateListener(S, org.jdesktop.beansbinding.PropertyStateListener)
-
-