Class Via<T>

java.lang.Object
org.jhotdraw8.fxbase.binding.Via<T>
Type Parameters:
T - the value type of the property

public class Via<T> extends Object
Builder for bindings that go via multiple properties.

Usage: Bind a text field to person.address.city.

     TextField cityField;
     Property<Person> personProperty;

     Via<Person> via = new Via<>(personProperty);
     cityField.textProperty().bindBidirectional(
         via.via(Person::addressProperty)
         .via(Address::cityProperty)
         .get()
     );
 

Creates change listeners that are strongly referenced from the root object.

When the root object is garbage collected, the change listeners unregister themselves.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Via(javafx.beans.property.Property<T> weakReferenceToRoot)
    Creates a new via builder.
  • Method Summary

    Modifier and Type
    Method
    Description
    javafx.beans.property.Property<T>
    get()
    Gets the binding that was built.
    <U> Via<U>
    via(Function<T,javafx.beans.property.Property<U>> viaFunction)
    Builds a new via step.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Via

      public Via(javafx.beans.property.Property<T> weakReferenceToRoot)
      Creates a new via builder.
      Parameters:
      weakReferenceToRoot - the root property
  • Method Details

    • via

      public <U> Via<U> via(Function<T,javafx.beans.property.Property<U>> viaFunction)
      Builds a new via step.
      Type Parameters:
      U - the type of the property
      Parameters:
      viaFunction - a function that returns the desired property
      Returns:
      a via binding to the property
    • get

      public javafx.beans.property.Property<T> get()
      Gets the binding that was built.
      Returns:
      a binding