Class IntegerConstant

java.lang.Object
com.sun.javafx.binding.IntegerConstant
All Implemented Interfaces:
Observable, ObservableIntegerValue, ObservableNumberValue, ObservableValue<Number>

public final class IntegerConstant extends Object implements ObservableIntegerValue
A simple IntegerExpression that represents a single constant value.
  • Method Details

    • valueOf

      public static IntegerConstant valueOf(int value)
    • get

      public int get()
      Description copied from interface: ObservableIntegerValue
      Returns the current value of this ObservableIntegerValue.
      Specified by:
      get in interface ObservableIntegerValue
      Returns:
      The current value
    • getValue

      public Integer getValue()
      Description copied from interface: ObservableValue
      Returns the current value of this ObservableValue
      Specified by:
      getValue in interface ObservableValue<Number>
      Returns:
      The current value
    • addListener

      public void addListener(InvalidationListener observer)
      Description copied from interface: Observable
      Adds an InvalidationListener which will be notified whenever the Observable becomes invalid. If the same listener is added more than once, then it will be notified more than once. That is, no check is made to ensure uniqueness.

      Note that the same actual InvalidationListener instance may be safely registered for different Observables.

      The Observable stores a strong reference to the listener which will prevent the listener from being garbage collected and may result in a memory leak. It is recommended to either unregister a listener by calling removeListener after use or to use an instance of WeakInvalidationListener avoid this situation.

      Specified by:
      addListener in interface Observable
      Parameters:
      observer - The listener to register
      See Also:
    • addListener

      public void addListener(ChangeListener<? super Number> listener)
      Description copied from interface: ObservableValue
      Adds a ChangeListener which will be notified whenever the value of the ObservableValue changes. If the same listener is added more than once, then it will be notified more than once. That is, no check is made to ensure uniqueness.

      Note that the same actual ChangeListener instance may be safely registered for different ObservableValues.

      The ObservableValue stores a strong reference to the listener which will prevent the listener from being garbage collected and may result in a memory leak. It is recommended to either unregister a listener by calling removeListener after use or to use an instance of WeakChangeListener avoid this situation.

      Specified by:
      addListener in interface ObservableValue<Number>
      Parameters:
      listener - The listener to register
      See Also:
    • removeListener

      public void removeListener(InvalidationListener observer)
      Description copied from interface: Observable
      Removes the given listener from the list of listeners, that are notified whenever the value of the Observable becomes invalid.

      If the given listener has not been previously registered (i.e. it was never added) then this method call is a no-op. If it had been previously added then it will be removed. If it had been added more than once, then only the first occurrence will be removed.

      Specified by:
      removeListener in interface Observable
      Parameters:
      observer - The listener to remove
      See Also:
    • removeListener

      public void removeListener(ChangeListener<? super Number> listener)
      Description copied from interface: ObservableValue
      Removes the given listener from the list of listeners, that are notified whenever the value of the ObservableValue changes.

      If the given listener has not been previously registered (i.e. it was never added) then this method call is a no-op. If it had been previously added then it will be removed. If it had been added more than once, then only the first occurrence will be removed.

      Specified by:
      removeListener in interface ObservableValue<Number>
      Parameters:
      listener - The listener to remove
      See Also:
    • intValue

      public int intValue()
      Description copied from interface: ObservableNumberValue
      Returns the value of this ObservableNumberValue as an int . If the value is not an int, a standard cast is performed.
      Specified by:
      intValue in interface ObservableNumberValue
      Returns:
      The value of this ObservableNumberValue as an int
    • longValue

      public long longValue()
      Description copied from interface: ObservableNumberValue
      Returns the value of this ObservableNumberValue as a long . If the value is not a long, a standard cast is performed.
      Specified by:
      longValue in interface ObservableNumberValue
      Returns:
      The value of this ObservableNumberValue as a long
    • floatValue

      public float floatValue()
      Description copied from interface: ObservableNumberValue
      Returns the value of this ObservableNumberValue as a float. If the value is not a float, a standard cast is performed.
      Specified by:
      floatValue in interface ObservableNumberValue
      Returns:
      The value of this ObservableNumberValue as a float
    • doubleValue

      public double doubleValue()
      Description copied from interface: ObservableNumberValue
      Returns the value of this ObservableNumberValue as a double. If the value is not a double, a standard cast is performed.
      Specified by:
      doubleValue in interface ObservableNumberValue
      Returns:
      The value of this ObservableNumberValue as a double