Package io.github.mmm.value.observable
Class BidirectionalBinding<V>
- java.lang.Object
-
- io.github.mmm.value.observable.BidirectionalBinding<V>
-
- Type Parameters:
V
- type of observedvalue
.
- All Implemented Interfaces:
EventListener<ObservableEvent<V>>
,ObservableEventListener<V>
public class BidirectionalBinding<V> extends Object implements ObservableEventListener<V>
ObservableEventListener
for a bidirectional binding.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <V> BidirectionalBinding<V>
bind(WritableObservableValue<V> property1, WritableObservableValue<V> property2)
boolean
equals(Object obj)
int
hashCode()
boolean
isMatchedUsingEquals()
void
onEvent(ObservableEvent<V> event)
This method is called if an event occurred.void
unbind()
static <V> void
unbind(WritableObservableValue<V> property1, WritableObservableValue<V> property2)
-
-
-
Method Detail
-
onEvent
public void onEvent(ObservableEvent<V> event)
Description copied from interface:EventListener
This method is called if an event occurred.
WARNING:
Depending on the implementation ofEventSource
it may NOT be legal toadd
orremove
listeners during the call of this method as this may lead to a dead-lock.- Specified by:
onEvent
in interfaceEventListener<V>
- Parameters:
event
- is the event that notifies about something that happened.
-
isMatchedUsingEquals
public boolean isMatchedUsingEquals()
- Specified by:
isMatchedUsingEquals
in interfaceEventListener<V>
- Returns:
true
if to match usingequals
,false
to match via object identity (compared using==
). For better performance the default isfalse
. If you implement this interface as a class overridingequals
in order to being able toremove
theEventListener
without keeping its reference by creating a newequal
EventListener
instance, then you simply need to override this method returningtrue
.
-
unbind
public void unbind()
-
bind
public static <V> BidirectionalBinding<V> bind(WritableObservableValue<V> property1, WritableObservableValue<V> property2)
- Type Parameters:
V
- type of observedvalue
.- Parameters:
property1
- the firstWritableObservableValue
to bind.property2
- the secondWritableObservableValue
to bind.- Returns:
- the
BidirectionalBinding
. - See Also:
WritableObservableValue.bindTwoWay(WritableObservableValue)
-
unbind
public static <V> void unbind(WritableObservableValue<V> property1, WritableObservableValue<V> property2)
- Type Parameters:
V
- type of observedvalue
.- Parameters:
property1
- the firstWritableObservableValue
to unbind.property2
- the secondWritableObservableValue
to unbind.- See Also:
WritableObservableValue.unbindTwoWay(WritableObservableValue)
-
-