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
public abstract class ObjectExpression<T> extends Object implements ObservableObjectValue<T>
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
| Constructor | Description |
|---|---|
ObjectExpression() |
Creates a default ObjectExpression. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
StringBinding |
asString() |
|
StringBinding |
asString |
|
StringBinding |
asString |
|
T |
getValue() |
Returns the current value of this ObservableValue
|
BooleanBinding |
isEqualTo |
Creates a new BooleanExpression that holds true if this ObjectExpression is equal to a constant value. |
BooleanBinding |
isEqualTo |
Creates a new BooleanExpression that holds true if this and another ObservableObjectValue are equal. |
BooleanBinding |
isNotEqualTo |
Creates a new BooleanExpression that holds true if this ObjectExpression is not equal to a constant value. |
BooleanBinding |
isNotEqualTo |
Creates a new BooleanExpression that holds true if this and another ObservableObjectValue are not equal. |
BooleanBinding |
isNotNull() |
|
BooleanBinding |
isNull() |
|
static <T> ObjectExpression |
objectExpression |
Returns an ObjectExpression that wraps an ObservableObjectValue. |
Methods declared in class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods declared in interface javafx.beans.Observable
addListener, removeListener, subscribe
Methods declared in interface javafx.beans.value.ObservableObjectValue
get
Methods declared in interface javafx.beans.value.ObservableValue
addListener, flatMap, map, orElse, removeListener, subscribe, subscribe, when
Constructor Details
ObjectExpression
public ObjectExpression()
Creates a default
ObjectExpression.Method Details
getValue
public T getValue()
Description copied from interface:
ObservableValueReturns the current value of this
ObservableValue
- Specified by:
-
getValuein interfaceObservableValue<T> - Returns:
- The current value
objectExpression
public static <T> ObjectExpression<T> objectExpression(ObservableObjectValue<T> value)
Returns an
ObjectExpression that wraps an ObservableObjectValue. If the ObservableObjectValue is already an ObjectExpression, it will be returned. Otherwise a new ObjectBinding is created that is bound to the ObservableObjectValue.- Type Parameters:
-
T- the type of the wrappedObject - Parameters:
-
value- The sourceObservableObjectValue - Returns:
- A
ObjectExpressionthat wraps theObservableObjectValueif necessary - Throws:
-
NullPointerException- ifvalueisnull
isEqualTo
public BooleanBinding isEqualTo(ObservableObjectValue<?> other)
Creates a new
BooleanExpression that holds true if this and another ObservableObjectValue are equal.- Parameters:
-
other- the otherObservableObjectValue - Returns:
- the new
BooleanExpression - Throws:
-
NullPointerException- ifotherisnull
isEqualTo
public BooleanBinding isEqualTo(Object other)
Creates a new
BooleanExpression that holds true if this ObjectExpression is equal to a constant value.- Parameters:
-
other- the constant value - Returns:
- the new
BooleanExpression
isNotEqualTo
public BooleanBinding isNotEqualTo(ObservableObjectValue<?> other)
Creates a new
BooleanExpression that holds true if this and another ObservableObjectValue are not equal.- Parameters:
-
other- the otherObservableObjectValue - Returns:
- the new
BooleanExpression - Throws:
-
NullPointerException- ifotherisnull
isNotEqualTo
public BooleanBinding isNotEqualTo(Object other)
Creates a new
BooleanExpression that holds true if this ObjectExpression is not equal to a constant value.- Parameters:
-
other- the constant value - Returns:
- the new
BooleanExpression
isNull
public BooleanBinding isNull()
- Returns:
- the new
BooleanBinding
isNotNull
public BooleanBinding isNotNull()
- Returns:
- the new
BooleanBinding
asString
public StringBinding asString()
Creates a
StringBinding that holds the value of this ObjectExpression turned into a String. If the value of this ObjectExpression changes, the value of the StringBinding will be updated automatically.- Returns:
- the new
StringBinding - Since:
- JavaFX 8.0
asString
public StringBinding asString(String format)
Creates a
StringBinding that holds the value of the ObjectExpression turned into a String. If the value of this ObjectExpression changes, the value of the StringBinding will be updated automatically. The result is formatted according to the formatting String. See java.util.Formatter for formatting rules.
- Parameters:
-
format- the formattingString - Returns:
- the new
StringBinding - Since:
- JavaFX 8.0
asString
public StringBinding asString(Locale locale, String format)
Creates a
StringBinding that holds the value of the NumberExpression turned into a String. If the value of this NumberExpression changes, the value of the StringBinding will be updated automatically. The result is formatted according to the formatting String and the passed in Locale. See java.util.Formatter for formatting rules. See java.util.Locale for details on Locale.
- Parameters:
-
locale- the Locale to be used -
format- the formattingString - Returns:
- the new
StringBinding - Since:
- JavaFX 8.0
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.