java.lang.Object
javafx.beans.binding.ObjectExpression<T>
- 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
Constructors Constructor Description ObjectExpression()
Creates a defaultObjectExpression
. -
Method Summary
Modifier and Type Method Description StringBinding
asString()
StringBinding
asString(String format)
StringBinding
asString(Locale locale, String format)
T
getValue()
Returns the current value of thisObservableValue
BooleanBinding
isEqualTo(Object other)
Creates a newBooleanExpression
that holdstrue
if thisObjectExpression
is equal to a constant value.BooleanBinding
isEqualTo(ObservableObjectValue<?> other)
Creates a newBooleanExpression
that holdstrue
if this and anotherObservableObjectValue
are equal.BooleanBinding
isNotEqualTo(Object other)
Creates a newBooleanExpression
that holdstrue
if thisObjectExpression
is not equal to a constant value.BooleanBinding
isNotEqualTo(ObservableObjectValue<?> other)
Creates a newBooleanExpression
that holdstrue
if this and anotherObservableObjectValue
are not equal.BooleanBinding
isNotNull()
BooleanBinding
isNull()
static <T> ObjectExpression<T>
objectExpression(ObservableObjectValue<T> value)
Returns anObjectExpression
that wraps anObservableObjectValue
.
-
Constructor Details
-
ObjectExpression
public ObjectExpression()Creates a defaultObjectExpression
.
-
-
Method Details
-
getValue
Description copied from interface:ObservableValue
Returns the current value of thisObservableValue
- Specified by:
getValue
in interfaceObservableValue<T>
- Returns:
- The current value
-
objectExpression
Returns anObjectExpression
that wraps anObservableObjectValue
. If theObservableObjectValue
is already anObjectExpression
, it will be returned. Otherwise a newObjectBinding
is created that is bound to theObservableObjectValue
.- Type Parameters:
T
- the type of the wrappedObject
- Parameters:
value
- The sourceObservableObjectValue
- Returns:
- A
ObjectExpression
that wraps theObservableObjectValue
if necessary - Throws:
NullPointerException
- ifvalue
isnull
-
isEqualTo
Creates a newBooleanExpression
that holdstrue
if this and anotherObservableObjectValue
are equal.- Parameters:
other
- the otherObservableObjectValue
- Returns:
- the new
BooleanExpression
- Throws:
NullPointerException
- ifother
isnull
-
isEqualTo
Creates a newBooleanExpression
that holdstrue
if thisObjectExpression
is equal to a constant value.- Parameters:
other
- the constant value- Returns:
- the new
BooleanExpression
-
isNotEqualTo
Creates a newBooleanExpression
that holdstrue
if this and anotherObservableObjectValue
are not equal.- Parameters:
other
- the otherObservableObjectValue
- Returns:
- the new
BooleanExpression
- Throws:
NullPointerException
- ifother
isnull
-
isNotEqualTo
Creates a newBooleanExpression
that holdstrue
if thisObjectExpression
is 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 aStringBinding
that holds the value of thisObjectExpression
turned into aString
. If the value of thisObjectExpression
changes, the value of theStringBinding
will be updated automatically.- Returns:
- the new
StringBinding
- Since:
- JavaFX 8.0
-
asString
Creates aStringBinding
that holds the value of theObjectExpression
turned into aString
. If the value of thisObjectExpression
changes, the value of theStringBinding
will be updated automatically.The result is formatted according to the formatting
String
. Seejava.util.Formatter
for formatting rules.- Parameters:
format
- the formattingString
- Returns:
- the new
StringBinding
- Since:
- JavaFX 8.0
-
asString
Creates aStringBinding
that holds the value of theNumberExpression
turned into aString
. If the value of thisNumberExpression
changes, the value of theStringBinding
will be updated automatically.The result is formatted according to the formatting
String
and the passed inLocale
. Seejava.util.Formatter
for formatting rules. Seejava.util.Locale
for details onLocale
.- Parameters:
locale
- the Locale to be usedformat
- the formattingString
- Returns:
- the new
StringBinding
- Since:
- JavaFX 8.0
-