Module javafx.base
Package javafx.beans.binding

## 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

    Constructors
    Constructor | Description
    --- | ---
    `BooleanExpression()` | Sole constructor

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `BooleanBinding` | `and​(ObservableBooleanValue other)` | 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()` | Creates a `StringBinding` that holds the value of this `BooleanExpression` turned into a `String`.
    `static BooleanExpression` | `booleanExpression​(ObservableBooleanValue value)` | Returns a `BooleanExpression` that wraps a `ObservableBooleanValue`.
    `static BooleanExpression` | `booleanExpression​(ObservableValue<Boolean> value)` | Returns a `BooleanExpression` that wraps an `ObservableValue`.
    `Boolean` | `getValue()` | Returns the current value of this `ObservableValue`
    `BooleanBinding` | `isEqualTo​(ObservableBooleanValue other)` | Creates a new `BooleanExpression` that holds `true` if this and another `ObservableBooleanValue` are equal.
    `BooleanBinding` | `isNotEqualTo​(ObservableBooleanValue other)` | 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​(ObservableBooleanValue other)` | Creates a new `BooleanExpression` that performs the conditional OR-operation on this `BooleanExpression` and a `ObservableBooleanValue`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface javafx.beans.Observable

      `addListener, removeListener`

    - ### Methods inherited from interface javafx.beans.value.ObservableBooleanValue

      `get`

    - ### Methods inherited from interface javafx.beans.value.ObservableValue

      `addListener, removeListener`

- - ### Constructor Detail

    - #### BooleanExpression

          public BooleanExpression()

      Sole constructor

  - ### Method Detail

    - #### 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