Class BooleanExpression
java.lang.Object
javafx.beans.binding.BooleanExpression
- All Implemented Interfaces:
-
Observable,ObservableBooleanValue,ObservableValue<Boolean>
- Direct Known Subclasses:
-
BooleanBinding,ReadOnlyBooleanProperty
public abstract class BooleanExpression extends Object implements ObservableBooleanValue
BooleanExpression is an ObservableBooleanValue plus additional convenience methods to generate bindings in a fluent style. A concrete sub-class of BooleanExpression has to implement the method ObservableBooleanValue.get(), which provides the actual value of this expression.
- Since:
- JavaFX 2.0
Constructor Summary
| Constructor | Description |
|---|---|
BooleanExpression() |
Creates a default BooleanExpression. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
BooleanBinding |
and |
Creates a new BooleanExpression that performs the conditional AND-operation on this BooleanExpression and a ObservableBooleanValue. |
ObjectExpression<Boolean> |
asObject() |
Creates an ObjectExpression that holds the value of this BooleanExpression. |
StringBinding |
asString() |
|
static BooleanExpression |
booleanExpression |
Returns a BooleanExpression that wraps a ObservableBooleanValue. |
static BooleanExpression |
booleanExpression |
Returns a BooleanExpression that wraps an ObservableValue. |
Boolean |
getValue() |
Returns the current value of this ObservableValue
|
BooleanBinding |
isEqualTo |
Creates a new BooleanExpression that holds true if this and another ObservableBooleanValue are equal. |
BooleanBinding |
isNotEqualTo |
Creates a new BooleanExpression that holds true if this and another ObservableBooleanValue are equal. |
BooleanBinding |
not() |
Creates a new BooleanExpression that calculates the negation of this BooleanExpression. |
BooleanBinding |
or |
Creates a new BooleanExpression that performs the conditional OR-operation on this BooleanExpression and a ObservableBooleanValue. |
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.ObservableBooleanValue
get
Methods declared in interface javafx.beans.value.ObservableValue
addListener, flatMap, map, orElse, removeListener, subscribe, subscribe, when
Constructor Details
BooleanExpression
public BooleanExpression()
Creates a default
BooleanExpression.Method Details
getValue
public Boolean getValue()
Description copied from interface:
ObservableValueReturns the current value of this
ObservableValue
- Specified by:
-
getValuein interfaceObservableValue<Boolean> - Returns:
- The current value
booleanExpression
public static BooleanExpression booleanExpression(ObservableBooleanValue value)
Returns a
BooleanExpression that wraps a ObservableBooleanValue. If the ObservableBooleanValue is already a BooleanExpression, it will be returned. Otherwise a new BooleanBinding is created that is bound to the ObservableBooleanValue.- Parameters:
-
value- The sourceObservableBooleanValue - Returns:
- A
BooleanExpressionthat wraps theObservableBooleanValueif necessary - Throws:
-
NullPointerException- ifvalueisnull
booleanExpression
public static BooleanExpression booleanExpression(ObservableValue<Boolean> value)
Returns a
BooleanExpression that wraps an ObservableValue. If the ObservableValue is already a BooleanExpression, it will be returned. Otherwise a new BooleanBinding is created that is bound to the ObservableValue. Note: null values will be interpreted as "false".- Parameters:
-
value- The sourceObservableValue - Returns:
- A
BooleanExpressionthat wraps theObservableValueif necessary - Throws:
-
NullPointerException- ifvalueisnull - Since:
- JavaFX 8.0
and
public BooleanBinding and(ObservableBooleanValue other)
Creates a new
BooleanExpression that performs the conditional AND-operation on this BooleanExpression and a ObservableBooleanValue.- Parameters:
-
other- the otherObservableBooleanValue - Returns:
- the new
BooleanExpression - Throws:
-
NullPointerException- ifotherisnull
or
public BooleanBinding or(ObservableBooleanValue other)
Creates a new
BooleanExpression that performs the conditional OR-operation on this BooleanExpression and a ObservableBooleanValue.- Parameters:
-
other- the otherObservableBooleanValue - Returns:
- the new
BooleanExpression - Throws:
-
NullPointerException- ifotherisnull
not
public BooleanBinding not()
Creates a new
BooleanExpression that calculates the negation of this BooleanExpression.- Returns:
- the new
BooleanExpression
isEqualTo
public BooleanBinding isEqualTo(ObservableBooleanValue other)
Creates a new
BooleanExpression that holds true if this and another ObservableBooleanValue are equal.- Parameters:
-
other- the otherObservableBooleanValue - Returns:
- the new
BooleanExpression - Throws:
-
NullPointerException- ifotherisnull
isNotEqualTo
public BooleanBinding isNotEqualTo(ObservableBooleanValue other)
Creates a new
BooleanExpression that holds true if this and another ObservableBooleanValue are equal.- Parameters:
-
other- the otherObservableBooleanValue - Returns:
- the new
BooleanExpression - Throws:
-
NullPointerException- ifotherisnull
asString
public StringBinding asString()
Creates a
StringBinding that holds the value of this BooleanExpression turned into a String. If the value of this BooleanExpression changes, the value of the StringBinding will be updated automatically.- Returns:
- the new
StringBinding
asObject
public ObjectExpression<Boolean> asObject()
Creates an
ObjectExpression that holds the value of this BooleanExpression. If the value of this BooleanExpression changes, the value of the ObjectExpression will be updated automatically.- Returns:
- the new
ObjectExpression - 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.