Class ObjectExpression<T>
java.lang.Object
javafx.beans.binding.ObjectExpression<T>
- Type Parameters:
T- the type of expression value
- All Implemented Interfaces:
Observable, ObservableObjectValue<T>, ObservableValue<T>
- Direct Known Subclasses:
ObjectBinding, ReadOnlyObjectProperty
ObjectExpression is an
ObservableObjectValue plus additional convenience
methods to generate bindings in a fluent style.
A concrete sub-class of ObjectExpression has to implement the method
ObservableObjectValue.get(), which provides the
actual value of this expression.
- Since:
- JavaFX 2.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasString()getValue()Returns the current value of thisObservableValueCreates a newBooleanExpressionthat holdstrueif thisObjectExpressionis equal to a constant value.isEqualTo(ObservableObjectValue<?> other) Creates a newBooleanExpressionthat holdstrueif this and anotherObservableObjectValueare equal.isNotEqualTo(Object other) Creates a newBooleanExpressionthat holdstrueif thisObjectExpressionis not equal to a constant value.isNotEqualTo(ObservableObjectValue<?> other) Creates a newBooleanExpressionthat holdstrueif this and anotherObservableObjectValueare not equal.isNull()static <T> ObjectExpression<T> objectExpression(ObservableObjectValue<T> value) Returns anObjectExpressionthat wraps anObservableObjectValue.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods declared in interface Observable
addListener, removeListener, subscribeModifier and TypeMethodDescriptionvoidaddListener(InvalidationListener listener) Adds anInvalidationListenerwhich will be notified whenever theObservablebecomes invalid.voidremoveListener(InvalidationListener listener) Removes the given listener from the list of listeners, that are notified whenever the value of theObservablebecomes invalid.default SubscriptionCreates aSubscriptionon thisObservablewhich callsinvalidationSubscriberwhenever it becomes invalid.Methods declared in interface ObservableObjectValue
getMethods declared in interface ObservableValue
addListener, flatMap, map, orElse, removeListener, subscribe, subscribe, whenModifier and TypeMethodDescriptionvoidaddListener(ChangeListener<? super T> listener) Adds aChangeListenerwhich will be notified whenever the value of theObservableValuechanges.default <U> ObservableValue<U> flatMap(Function<? super T, ? extends ObservableValue<? extends U>> mapper) Returns anObservableValuethat holds the value of anObservableValueproduced by applying the given mapping function on this value.default <U> ObservableValue<U> Returns anObservableValuethat holds the result of applying the given mapping function on this value.default ObservableValue<T> Returns anObservableValuethat holds this value, or the given constant if it isnull.voidremoveListener(ChangeListener<? super T> listener) Removes the given listener from the list of listeners that are notified whenever the value of theObservableValuechanges.default Subscriptionsubscribe(BiConsumer<? super T, ? super T> changeSubscriber) Creates aSubscriptionon thisObservableValuewhich calls the givenchangeSubscriberwith the old and new value whenever its value changes.default SubscriptionCreates aSubscriptionon thisObservableValuewhich immediately provides the current value to the givenvalueSubscriber, followed by any subsequent values whenever its value changes.default ObservableValue<T> when(ObservableValue<Boolean> condition) Returns anObservableValuethat holds this value and is updated only whenconditionholdstrue.
-
Constructor Details
-
ObjectExpression
public ObjectExpression()Creates a defaultObjectExpression.
-
-
Method Details
-
getValue
Description copied from interface:ObservableValueReturns the current value of thisObservableValue- Specified by:
getValuein interfaceObservableValue<T>- Returns:
- The current value
-
objectExpression
Returns anObjectExpressionthat wraps anObservableObjectValue. If theObservableObjectValueis already anObjectExpression, it will be returned. Otherwise a newObjectBindingis created that is bound to theObservableObjectValue.- Type Parameters:
T- the type of the wrappedObject- Parameters:
value- The sourceObservableObjectValue- Returns:
- A
ObjectExpressionthat wraps theObservableObjectValueif necessary - Throws:
NullPointerException- ifvalueisnull
-
isEqualTo
Creates a newBooleanExpressionthat holdstrueif this and anotherObservableObjectValueare equal.- Parameters:
other- the otherObservableObjectValue- Returns:
- the new
BooleanExpression - Throws:
NullPointerException- ifotherisnull
-
isEqualTo
Creates a newBooleanExpressionthat holdstrueif thisObjectExpressionis equal to a constant value.- Parameters:
other- the constant value- Returns:
- the new
BooleanExpression
-
isNotEqualTo
Creates a newBooleanExpressionthat holdstrueif this and anotherObservableObjectValueare not equal.- Parameters:
other- the otherObservableObjectValue- Returns:
- the new
BooleanExpression - Throws:
NullPointerException- ifotherisnull
-
isNotEqualTo
Creates a newBooleanExpressionthat holdstrueif thisObjectExpressionis not equal to a constant value.- Parameters:
other- the constant value- Returns:
- the new
BooleanExpression
-
isNull
- Returns:
- the new
BooleanBinding
-
isNotNull
- Returns:
- the new
BooleanBinding
-
asString
Creates aStringBindingthat holds the value of thisObjectExpressionturned into aString. If the value of thisObjectExpressionchanges, the value of theStringBindingwill be updated automatically.- Returns:
- the new
StringBinding - Since:
- JavaFX 8.0
-
asString
Creates aStringBindingthat holds the value of theObjectExpressionturned into aString. If the value of thisObjectExpressionchanges, the value of theStringBindingwill be updated automatically.The result is formatted according to the formatting
String. Seejava.util.Formatterfor formatting rules.- Parameters:
format- the formattingString- Returns:
- the new
StringBinding - Since:
- JavaFX 8.0
-
asString
Creates aStringBindingthat holds the value of theNumberExpressionturned into aString. If the value of thisNumberExpressionchanges, the value of theStringBindingwill be updated automatically.The result is formatted according to the formatting
Stringand the passed inLocale. Seejava.util.Formatterfor formatting rules. Seejava.util.Localefor details onLocale.- Parameters:
locale- the Locale to be usedformat- the formattingString- Returns:
- the new
StringBinding - Since:
- JavaFX 8.0
-