public class When extends Object
A ternary expression has the basic form
new When(cond).then(value1).otherwise(value2);
. The expression
cond
needs to be a ObservableBooleanValue
.
Based on the value of cond
, the binding contains the value of
value1
(if cond.getValue() == true
) or value2
(if
cond.getValue() == false
). The values value1
and
value2
have to be of the same type. They can be constant values or
implementations of ObservableValue
.
Modifier and Type | Class and Description |
---|---|
class |
When.BooleanConditionBuilder
An intermediate class needed while assembling the ternary expression.
|
class |
When.NumberConditionBuilder
If-then-else expression returning a number.
|
class |
When.ObjectConditionBuilder<T>
An intermediate class needed while assembling the ternary expression.
|
class |
When.StringConditionBuilder
An intermediate class needed while assembling the ternary expression.
|
Constructor and Description |
---|
When(ObservableBooleanValue condition)
The constructor of
When . |
Modifier and Type | Method and Description |
---|---|
When.BooleanConditionBuilder |
then(boolean thenValue)
Defines a constant value of the ternary expression, that is returned if
the condition is
true . |
When.NumberConditionBuilder |
then(double thenValue)
Defines a constant value of the ternary expression, that is returned if
the condition is
true . |
When.NumberConditionBuilder |
then(float thenValue)
Defines a constant value of the ternary expression, that is returned if
the condition is
true . |
When.NumberConditionBuilder |
then(int thenValue)
Defines a constant value of the ternary expression, that is returned if
the condition is
true . |
When.NumberConditionBuilder |
then(long thenValue)
Defines a constant value of the ternary expression, that is returned if
the condition is
true . |
When.BooleanConditionBuilder |
then(ObservableBooleanValue thenValue)
Defines the
ObservableBooleanValue which value
is returned by the ternary expression if the condition is true . |
When.NumberConditionBuilder |
then(ObservableNumberValue thenValue)
Defines the
ObservableNumberValue which value
is returned by the ternary expression if the condition is true . |
<T> When.ObjectConditionBuilder<T> |
then(ObservableObjectValue<T> thenValue)
Defines the
ObservableObjectValue which value
is returned by the ternary expression if the condition is true . |
When.StringConditionBuilder |
then(ObservableStringValue thenValue)
Defines the
ObservableStringValue which value
is returned by the ternary expression if the condition is true . |
When.StringConditionBuilder |
then(String thenValue)
Defines a constant value of the ternary expression, that is returned if
the condition is
true . |
<T> When.ObjectConditionBuilder<T> |
then(T thenValue)
Defines a constant value of the ternary expression, that is returned if
the condition is
true . |
public When(ObservableBooleanValue condition)
When
.condition
- the condition of the ternary expressionpublic When.NumberConditionBuilder then(ObservableNumberValue thenValue)
ObservableNumberValue
which value
is returned by the ternary expression if the condition is true
.thenValue
- the valuepublic When.NumberConditionBuilder then(double thenValue)
true
.thenValue
- the valuepublic When.NumberConditionBuilder then(float thenValue)
true
.thenValue
- the valuepublic When.NumberConditionBuilder then(long thenValue)
true
.thenValue
- the valuepublic When.NumberConditionBuilder then(int thenValue)
true
.thenValue
- the valuepublic When.BooleanConditionBuilder then(ObservableBooleanValue thenValue)
ObservableBooleanValue
which value
is returned by the ternary expression if the condition is true
.thenValue
- the valuepublic When.BooleanConditionBuilder then(boolean thenValue)
true
.thenValue
- the valuepublic When.StringConditionBuilder then(ObservableStringValue thenValue)
ObservableStringValue
which value
is returned by the ternary expression if the condition is true
.thenValue
- the valuepublic When.StringConditionBuilder then(String thenValue)
true
.thenValue
- the valuepublic <T> When.ObjectConditionBuilder<T> then(ObservableObjectValue<T> thenValue)
ObservableObjectValue
which value
is returned by the ternary expression if the condition is true
.thenValue
- the valuepublic <T> When.ObjectConditionBuilder<T> then(T thenValue)
true
.thenValue
- the valueSubmit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2008, 2017, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.