Class NonNullObjectProperty<T>

java.lang.Object
javafx.beans.binding.ObjectExpression<T>
javafx.beans.property.ReadOnlyObjectProperty<T>
javafx.beans.property.ObjectProperty<T>
javafx.beans.property.ObjectPropertyBase<T>
javafx.beans.property.SimpleObjectProperty<T>
org.jhotdraw8.fxbase.beans.NonNullObjectProperty<T>
Type Parameters:
T - the value type
All Implemented Interfaces:
javafx.beans.Observable, javafx.beans.property.Property<T>, javafx.beans.property.ReadOnlyProperty<T>, javafx.beans.value.ObservableObjectValue<T>, javafx.beans.value.ObservableValue<T>, javafx.beans.value.WritableObjectValue<T>, javafx.beans.value.WritableValue<T>

public class NonNullObjectProperty<T> extends javafx.beans.property.SimpleObjectProperty<T>
A NonNullProperty throws an IllegalArgumentException when attempting to set its value to null.
Author:
Werner Randelshofer
  • Constructor Summary

    Constructors
    Constructor
    Description
    NonNullObjectProperty(Object bean, String name, T initialValue)
    Creates a new instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
     
     
    void
    set(@Nullable T newValue)
    Sets a new value if it is not null.
    void
    setNonNull(T newValue)
     

    Methods inherited from class javafx.beans.property.SimpleObjectProperty

    getBean, getName

    Methods inherited from class javafx.beans.property.ObjectPropertyBase

    addListener, addListener, bind, get, invalidated, isBound, removeListener, removeListener, toString, unbind

    Methods inherited from class javafx.beans.property.ObjectProperty

    bindBidirectional, setValue, unbindBidirectional

    Methods inherited from class javafx.beans.binding.ObjectExpression

    asString, asString, asString, getValue, isEqualTo, isEqualTo, isNotEqualTo, isNotEqualTo, isNotNull, isNull, objectExpression

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface javafx.beans.Observable

    subscribe

    Methods inherited from interface javafx.beans.value.ObservableValue

    flatMap, getValue, map, orElse, subscribe, subscribe, when

    Methods inherited from interface javafx.beans.value.WritableValue

    getValue
  • Constructor Details

    • NonNullObjectProperty

      public NonNullObjectProperty(Object bean, String name, T initialValue)
      Creates a new instance.
      Parameters:
      bean - The bean which holds this property
      name - The name of the property
      initialValue - The initial value. NonNull.
  • Method Details

    • fireValueChangedEvent

      protected void fireValueChangedEvent()
      Overrides:
      fireValueChangedEvent in class javafx.beans.property.ObjectPropertyBase<T>
    • set

      public void set(@Nullable T newValue)
      Sets a new value if it is not null.
      Specified by:
      set in interface javafx.beans.value.WritableObjectValue<T>
      Overrides:
      set in class javafx.beans.property.ObjectPropertyBase<T>
    • getNonNull

      public T getNonNull()
    • setNonNull

      public void setNonNull(T newValue)