Module javafx.base

Class ObjectExpression<T>

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 Details

    • ObjectExpression

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

    • 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