Module javafx.base

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 Details

    • BooleanExpression

      public BooleanExpression()
      Creates a default BooleanExpression.
  • Method Details

    • getValue

      public Boolean getValue()
      Description copied from interface: ObservableValue
      Returns the current value of this ObservableValue
      Specified by:
      getValue in interface ObservableValue<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 source ObservableBooleanValue
      Returns:
      A BooleanExpression that wraps the ObservableBooleanValue if necessary
      Throws:
      NullPointerException - if value is null
    • 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 source ObservableValue
      Returns:
      A BooleanExpression that wraps the ObservableValue if necessary
      Throws:
      NullPointerException - if value is null
      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 other ObservableBooleanValue
      Returns:
      the new BooleanExpression
      Throws:
      NullPointerException - if other is null
    • 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 other ObservableBooleanValue
      Returns:
      the new BooleanExpression
      Throws:
      NullPointerException - if other is null
    • 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 other ObservableBooleanValue
      Returns:
      the new BooleanExpression
      Throws:
      NullPointerException - if other is null
    • isNotEqualTo

      public BooleanBinding isNotEqualTo​(ObservableBooleanValue other)
      Creates a new BooleanExpression that holds true if this and another ObservableBooleanValue are equal.
      Parameters:
      other - the other ObservableBooleanValue
      Returns:
      the new BooleanExpression
      Throws:
      NullPointerException - if other is null
    • 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