Module javafx.base
Package javafx.beans.binding

# Class ObjectExpression<T>

java.lang.Object
javafx.beans.binding.ObjectExpression<T>

Type Parameters:
  `T` - the type of expression value

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 default `ObjectExpression`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `StringBinding`
  `asString()`
  Creates a `StringBinding` that holds the value of this `ObjectExpression` turned into a `String`.
  `StringBinding`
  `asString(String format)`
  Creates a `StringBinding` that holds the value of the `ObjectExpression` turned into a `String`.
  `StringBinding`
  `asString(Locale locale, String format)`
  Creates a `StringBinding` that holds the value of the `NumberExpression` turned into a `String`.
  `T`
  `getValue()`
  Returns the current value of this `ObservableValue`
  `BooleanBinding`
  `isEqualTo(Object other)`
  Creates a new `BooleanExpression` that holds `true` if this `ObjectExpression` is equal to a constant value.
  `BooleanBinding`
  `isEqualTo(ObservableObjectValue<?> other)`
  Creates a new `BooleanExpression` that holds `true` if this and another `ObservableObjectValue` are equal.
  `BooleanBinding`
  `isNotEqualTo(Object other)`
  Creates a new `BooleanExpression` that holds `true` if this `ObjectExpression` is not equal to a constant value.
  `BooleanBinding`
  `isNotEqualTo(ObservableObjectValue<?> other)`
  Creates a new `BooleanExpression` that holds `true` if this and another `ObservableObjectValue` are not equal.
  `BooleanBinding`
  `isNotNull()`
  Creates a new `BooleanBinding` that holds `true` if this `ObjectExpression` is not `null`.
  `BooleanBinding`
  `isNull()`
  Creates a new `BooleanBinding` that holds `true` if this `ObjectExpression` is `null`.
  `static <T> ObjectExpression<T>`
  `objectExpression(ObservableObjectValue<T> value)`
  Returns an `ObjectExpression` that wraps an `ObservableObjectValue`.

  ### Methods declared in class java.lang.Object

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

  ### Methods declared in interface javafx.beans.Observable

  `addListener, removeListener, subscribe`

  ### Methods declared in interface javafx.beans.value.ObservableObjectValue

  `get`

  ### Methods declared in interface javafx.beans.value.ObservableValue

  `addListener, flatMap, map, orElse, removeListener, subscribe, subscribe, when`

- ## Constructor Details

  - ### ObjectExpression

    public ObjectExpression()
    Creates a default `ObjectExpression`.

- ## Method Details

  - ### getValue

    public T getValue()
    Description copied from interface: `ObservableValue`
    Returns the current value of this `ObservableValue`
    Specified by:
      `getValue` in interface `ObservableValue<T>`
    Returns:
      The current value

  - ### objectExpression

    public static <T> ObjectExpression<T> objectExpression(ObservableObjectValue<T> value)
    Returns an `ObjectExpression` that wraps an `ObservableObjectValue`. If the `ObservableObjectValue` is already an `ObjectExpression`, it will be returned. Otherwise a new `ObjectBinding` is created that is bound to the `ObservableObjectValue`.
    Type Parameters:
      `T` - the type of the wrapped `Object`
    Parameters:
      `value` - The source `ObservableObjectValue`
    Returns:
      A `ObjectExpression` that wraps the `ObservableObjectValue` if necessary
    Throws:
      `NullPointerException` - if `value` is `null`

  - ### isEqualTo

    public BooleanBinding isEqualTo(ObservableObjectValue<?> other)
    Creates a new `BooleanExpression` that holds `true` if this and another `ObservableObjectValue` are equal.
    Parameters:
      `other` - the other `ObservableObjectValue`
    Returns:
      the new `BooleanExpression`
    Throws:
      `NullPointerException` - if `other` is `null`

  - ### isEqualTo

    public BooleanBinding isEqualTo(Object other)
    Creates a new `BooleanExpression` that holds `true` if this `ObjectExpression` is equal to a constant value.
    Parameters:
      `other` - the constant value
    Returns:
      the new `BooleanExpression`

  - ### isNotEqualTo

    public BooleanBinding isNotEqualTo(ObservableObjectValue<?> other)
    Creates a new `BooleanExpression` that holds `true` if this and another `ObservableObjectValue` are not equal.
    Parameters:
      `other` - the other `ObservableObjectValue`
    Returns:
      the new `BooleanExpression`
    Throws:
      `NullPointerException` - if `other` is `null`

  - ### isNotEqualTo

    public BooleanBinding isNotEqualTo(Object other)
    Creates a new `BooleanExpression` that holds `true` if this `ObjectExpression` is not equal to a constant value.
    Parameters:
      `other` - the constant value
    Returns:
      the new `BooleanExpression`

  - ### isNull

    public BooleanBinding isNull()
    Creates a new `BooleanBinding` that holds `true` if this `ObjectExpression` is `null`.
    Returns:
      the new `BooleanBinding`

  - ### isNotNull

    public BooleanBinding isNotNull()
    Creates a new `BooleanBinding` that holds `true` if this `ObjectExpression` is not `null`.
    Returns:
      the new `BooleanBinding`

  - ### asString

    public StringBinding asString()
    Creates a `StringBinding` that holds the value of this `ObjectExpression` turned into a `String`. If the value of this `ObjectExpression` changes, the value of the `StringBinding` will be updated automatically.
    Returns:
      the new `StringBinding`
    Since:
      JavaFX 8.0

  - ### asString

    public StringBinding asString(String format)
    Creates a `StringBinding` that holds the value of the `ObjectExpression` turned into a `String`. If the value of this `ObjectExpression` changes, the value of the `StringBinding` will be updated automatically.

    The result is formatted according to the formatting `String`. See `java.util.Formatter` for formatting rules.

    Parameters:
      `format` - the formatting `String`
    Returns:
      the new `StringBinding`
    Since:
      JavaFX 8.0

  - ### asString

    public StringBinding asString(Locale locale, String format)
    Creates a `StringBinding` that holds the value of the `NumberExpression` turned into a `String`. If the value of this `NumberExpression` changes, the value of the `StringBinding` will be updated automatically.

    The result is formatted according to the formatting `String` and the passed in `Locale`. See `java.util.Formatter` for formatting rules. See `java.util.Locale` for details on `Locale`.

    Parameters:
      `locale` - the Locale to be used
      `format` - the formatting `String`
    Returns:
      the new `StringBinding`
    Since:
      JavaFX 8.0