| Interface | Description |
|---|---|
| Binding<T> | A Binding calculates a value that depends on one or more sources. |
| NumberBinding | A tagging interface to mark all Bindings that wrap a number-value. |
| NumberExpression | A NumberExpression is a ObservableNumberValue plus additional convenience methods to generate bindings in a fluent style. |
| Class | Description |
|---|---|
| Bindings | Bindings is a helper class with a lot of utility functions to create simple bindings. |
| BooleanBinding | Base class that provides most of the functionality needed to implement a Binding of a boolean value. |
| BooleanExpression | A BooleanExpression is a ObservableBooleanValue plus additional convenience methods to generate bindings in a fluent style. |
| DoubleBinding | Base class that provides most of the functionality needed to implement a Binding of a double value. |
| DoubleExpression | A DoubleExpression is a ObservableDoubleValue plus additional convenience methods to generate bindings in a fluent style. |
| FloatBinding | Base class that provides most of the functionality needed to implement a Binding of a float value. |
| FloatExpression | A FloatExpression is a ObservableFloatValue plus additional convenience methods to generate bindings in a fluent style. |
| IntegerBinding | Base class that provides most of the functionality needed to implement a Binding of an int value. |
| IntegerExpression | A IntegerExpression is a ObservableIntegerValue plus additional convenience methods to generate bindings in a fluent style. |
| ListBinding<E> | Base class that provides most of the functionality needed to implement a Binding of an ObservableList. |
| ListExpression<E> | A ListExpression is a ObservableListValue plus additional convenience methods to generate bindings in a fluent style. |
| LongBinding | Base class that provides most of the functionality needed to implement a Binding of a long value. |
| LongExpression | A LongExpression is a ObservableLongValue plus additional convenience methods to generate bindings in a fluent style. |
| MapBinding<K,V> | Base class that provides most of the functionality needed to implement a Binding of an ObservableMap. |
| MapExpression<K,V> | A MapExpression is a ObservableMapValue plus additional convenience methods to generate bindings in a fluent style. |
| NumberExpressionBase | A NumberExpressionBase contains convenience methods to generate bindings in a fluent style, that are common to all NumberExpression subclasses. |
| ObjectBinding<T> | Base class that provides most of the functionality needed to implement a Binding of an Object. |
| ObjectExpression<T> | A ObjectExpression is a ObservableObjectValue plus additional convenience methods to generate bindings in a fluent style. |
| SetBinding<E> | Base class that provides most of the functionality needed to implement a Binding of an ObservableSet. |
| SetExpression<E> | A SetExpression is a ObservableSetValue plus additional convenience methods to generate bindings in a fluent style. |
| StringBinding | Base class that provides most of the functionality needed to implement a Binding of a String. |
| StringExpression | A StringExpression is a ObservableStringValue plus additional convenience methods to generate bindings in a fluent style. |
| When | Starting point for a binding that calculates a ternary expression. |
Package javafx.beans.binding Description
Characteristics of Bindings
Bindings are assembled from one or more sources, usually called their dependencies. A binding observes its dependencies for changes and updates its own value according to changes in the dependencies.
Almost all bindings defined in this library require implementations of Observable for their dependencies. There are two types of implementations already provided, the properties in the package javafx.beans.property and the observable collections (ObservableList and ObservableMap). Bindings also implement Observable and can again serve as sources for other bindings allowing to construct very complex bindings from simple ones.
Bindings in our implementation are always calculated lazily. That means, if a dependency changes, the result of a binding is not immediately recalculated, but it is marked as invalid. Next time the value of an invalid binding is requested, it is recalculated.
High Level API and Low Level API
The Binding API is roughly divided in two parts, the High Level Binding API and the Low Level Binding API. The High Level Binding API allows to construct simple bindings in an easy to use fashion. Defining a binding with the High Level API should be straightforward, especially when used in an IDE that provides code completion. Unfortunately it has its limitation and at that point the Low Level API comes into play. Experienced Java developers can use the Low Level API to define bindings, if the functionality of the High Level API is not sufficient or to improve the performance. The main goals of the Low Level API are fast execution and small memory footprint.
Following is an example of how both APIs can be used. Assuming we have four instances of DoubleProperty a, b, c , and d, we can define a binding that calculates a*b
+ c*d with the High Level API for example like this:
NumberBinding result = Bindings.add (a.multiply(b),
c.multiply(d));
Defining the same binding using the Low Level API could be done like this:
DoubleBinding foo = new DoubleBinding() {
{
super.bind(a, b, c, d);
}
@Override
protected double computeValue() {
return a.getValue() * b.getValue() + c.getValue() * d.getValue();
}
};
© 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.