Module javafx.base

Class LongExpression

    • Constructor Detail

      • LongExpression

        public LongExpression()
    • Method Detail

      • longExpression

        public static LongExpression longExpression​(ObservableLongValue value)
        Returns a LongExpression that wraps a ObservableLongValue. If the ObservableLongValue is already a LongExpression, it will be returned. Otherwise a new LongBinding is created that is bound to the ObservableLongValue.
        Parameters:
        value - The source ObservableLongValue
        Returns:
        A LongExpression that wraps the ObservableLongValue if necessary
        Throws:
        NullPointerException - if value is null
      • longExpression

        public static <T extends NumberLongExpression longExpression​(ObservableValue<T> value)
        Returns a LongExpression that wraps an ObservableValue. If the ObservableValue is already a LongExpression, it will be returned. Otherwise a new LongBinding is created that is bound to the ObservableValue.

        Note: this method can be used to convert an ObjectExpression or ObjectProperty of specific number type to LongExpression, which is essentially an ObservableValue<Number>. See sample below.

           LongProperty longProperty = new SimpleLongProperty(1L);
           ObjectProperty<Long> objectProperty = new SimpleObjectProperty<>(2L);
           BooleanBinding binding = longProperty.greaterThan(LongExpression.longExpression(objectProperty));
         
        Note: null values will be interpreted as 0L
        Type Parameters:
        T - The type of Number to be wrapped
        Parameters:
        value - The source ObservableValue
        Returns:
        A LongExpression that wraps the ObservableValue if necessary
        Throws:
        NullPointerException - if value is null
        Since:
        JavaFX 8.0
      • asObject

        public ObjectExpression<Long> asObject()
        Creates an ObjectExpression that holds the value of this LongExpression. If the value of this LongExpression changes, the value of the ObjectExpression will be updated automatically.
        Returns:
        the new ObjectExpression
        Since:
        JavaFX 8.0