< prev index next >

modules/javafx.base/src/main/java/javafx/beans/binding/Bindings.java

Print this page
rev 10444 : imported patch doc-8177566-trampoline
rev 10445 : [mq]: doc-v1-8177566-trampoline


  80  * <p>
  81  * Or using only factory methods in Bindings:
  82  * <p>
  83  * {@code NumberBinding result = add (multiply(a, b), multiply(c,d));}
  84  * <p>
  85  * Or mixing both possibilities:
  86  * <p>
  87  * {@code NumberBinding result = add (a.multiply(b), c.multiply(d));}
  88  * <p>
  89  * The main difference between using the Fluent API and using the factory
  90  * methods in this class is that the Fluent API requires that at least one of
  91  * the operands is an Expression (see {@link javafx.beans.binding}). (Every
  92  * Expression contains a static method that generates an Expression from an
  93  * {@link javafx.beans.value.ObservableValue}.)
  94  * <p>
  95  * Also if you watched closely, you might have noticed that the return type of
  96  * the Fluent API is different in the examples above. In a lot of cases the
  97  * Fluent API allows to be more specific about the returned type (see
  98  * {@link javafx.beans.binding.NumberExpression} for more details about implicit
  99  * casting.

























 100  *
 101  * @see Binding
 102  * @see NumberBinding
 103  *
 104  *
 105  * @since JavaFX 2.0
 106  */
 107 public final class Bindings {
 108 
 109     private Bindings() {
 110     }
 111 
 112     // =================================================================================================================
 113     // Helper functions to create custom bindings
 114 
 115     /**
 116      * Helper function to create a custom {@link BooleanBinding}.
 117      *
 118      * @param func The function that calculates the value of this binding
 119      * @param dependencies The dependencies of this binding


 386             public ObservableList<?> getDependencies() {
 387                 return  ((dependencies == null) || (dependencies.length == 0))?
 388                             FXCollections.emptyObservableList()
 389                         : (dependencies.length == 1)?
 390                             FXCollections.singletonObservableList(dependencies[0])
 391                         : new ImmutableObservableList<Observable>(dependencies);
 392             }
 393         };
 394     }
 395 
 396 
 397     // =================================================================================================================
 398     // Select Bindings
 399 
 400     /**
 401      * Creates a binding used to get a member, such as {@code a.b.c}. The value
 402      * of the binding will be {@code c}, or {@code null} if {@code c} could not
 403      * be reached (due to {@code b} not having a {@code c} property,
 404      * {@code b} being {@code null}, or {@code c} not being the right type etc.).
 405      * <p>
 406      * All classes and properties used in a select-binding have to be public.
 407      *





 408      * Note: since 8.0, JavaBeans properties are supported and might be in the chain.

 409      *
 410      * @param <T> the type of the wrapped {@code Object}
 411      * @param root
 412      *            The root {@link javafx.beans.value.ObservableValue}
 413      * @param steps
 414      *            The property names to reach the final property
 415      * @return the created {@link ObjectBinding}
 416      */
 417     public static <T> ObjectBinding<T> select(ObservableValue<?> root, String... steps) {
 418         return new SelectBinding.AsObject<T>(root, steps);
 419     }
 420 
 421     /**
 422      * Creates a binding used to get a member, such as {@code a.b.c}. The value
 423      * of the binding will be {@code c}, or {@code 0.0} if {@code c} could not
 424      * be reached (due to {@code b} not having a {@code c} property,
 425      * {@code b} being {@code null}, or {@code c} not being a {@code Number} etc.).
 426      * <p>
 427      * All classes and properties used in a select-binding have to be public.
 428      *





 429      * Note: since 8.0, JavaBeans properties are supported and might be in the chain.

 430      *
 431      * @param root
 432      *            The root {@link javafx.beans.value.ObservableValue}
 433      * @param steps
 434      *            The property names to reach the final property
 435      * @return the created {@link DoubleBinding}
 436      */
 437     public static DoubleBinding selectDouble(ObservableValue<?> root, String... steps) {
 438         return new SelectBinding.AsDouble(root, steps);
 439     }
 440 
 441     /**
 442      * Creates a binding used to get a member, such as {@code a.b.c}. The value
 443      * of the binding will be {@code c}, or {@code 0.0f} if {@code c} could not
 444      * be reached (due to {@code b} not having a {@code c} property,
 445      * {@code b} being {@code null}, or {@code c} not being a {@code Number} etc.).
 446      * <p>
 447      * All classes and properties used in a select-binding have to be public.
 448      *





 449      * Note: since 8.0, JavaBeans properties are supported and might be in the chain.

 450      *
 451      * @param root
 452      *            The root {@link javafx.beans.value.ObservableValue}
 453      * @param steps
 454      *            The property names to reach the final property
 455      * @return the created {@link FloatBinding}
 456      */
 457     public static FloatBinding selectFloat(ObservableValue<?> root, String... steps) {
 458         return new SelectBinding.AsFloat(root, steps);
 459     }
 460 
 461     /**
 462      * Creates a binding used to get a member, such as {@code a.b.c}. The value
 463      * of the binding will be {@code c}, or {@code 0} if {@code c} could not
 464      * be reached (due to {@code b} not having a {@code c} property,
 465      * {@code b} being {@code null}, or {@code c} not being a {@code Number} etc.).
 466      * <p>
 467      * All classes and properties used in a select-binding have to be public.
 468      *





 469      * Note: since 8.0, JavaBeans properties are supported and might be in the chain.

 470      *
 471      * @param root
 472      *            The root {@link javafx.beans.value.ObservableValue}
 473      * @param steps
 474      *            The property names to reach the final property
 475      * @return the created {@link IntegerBinding}
 476      */
 477     public static IntegerBinding selectInteger(ObservableValue<?> root, String... steps) {
 478         return new SelectBinding.AsInteger(root, steps);
 479     }
 480 
 481     /**
 482      * Creates a binding used to get a member, such as {@code a.b.c}. The value
 483      * of the binding will be {@code c}, or {@code 0L} if {@code c} could not
 484      * be reached (due to {@code b} not having a {@code c} property,
 485      * {@code b} being {@code null}, or {@code c} not being a {@code Number} etc.).
 486      * <p>
 487      * All classes and properties used in a select-binding have to be public.
 488      *





 489      * Note: since 8.0, JavaBeans properties are supported and might be in the chain.

 490      *
 491      * @param root
 492      *            The root {@link javafx.beans.value.ObservableValue}
 493      * @param steps
 494      *            The property names to reach the final property
 495      * @return the created {@link LongBinding}
 496      */
 497     public static LongBinding selectLong(ObservableValue<?> root, String... steps) {
 498         return new SelectBinding.AsLong(root, steps);
 499     }
 500 
 501     /**
 502      * Creates a binding used to get a member, such as {@code a.b.c}. The value
 503      * of the binding will be {@code c}, or {@code false} if {@code c} could not
 504      * be reached (due to {@code b} not having a {@code c} property,
 505      * {@code b} being {@code null}, or {@code c} not being a {@code boolean} etc.).
 506      * <p>
 507      * All classes and properties used in a select-binding have to be public.
 508      *





 509      * Note: since 8.0, JavaBeans properties are supported and might be in the chain.

 510      *
 511      * @param root
 512      *            The root {@link javafx.beans.value.ObservableValue}
 513      * @param steps
 514      *            The property names to reach the final property
 515      * @return the created {@link ObjectBinding}
 516      */
 517     public static BooleanBinding selectBoolean(ObservableValue<?> root, String... steps) {
 518         return new SelectBinding.AsBoolean(root, steps);
 519     }
 520 
 521     /**
 522      * Creates a binding used to get a member, such as {@code a.b.c}. The value
 523      * of the binding will be {@code c}, or {@code ""} if {@code c} could not
 524      * be reached (due to {@code b} not having a {@code c} property,
 525      * {@code b} being {@code null}, or {@code c} not being a {@code String} etc.).
 526      * <p>
 527      * All classes and properties used in a select-binding have to be public.
 528      *





 529      * Note: since 8.0, JavaBeans properties are supported and might be in the chain.

 530      *
 531      * @param root
 532      *            The root {@link javafx.beans.value.ObservableValue}
 533      * @param steps
 534      *            The property names to reach the final property
 535      * @return the created {@link ObjectBinding}
 536      */
 537     public static StringBinding selectString(ObservableValue<?> root, String... steps) {
 538         return new SelectBinding.AsString(root, steps);
 539     }
 540 
 541     /**
 542      * Creates a binding used to get a member, such as {@code a.b.c}. The value
 543      * of the binding will be {@code c}, or {@code null} if {@code c} could not
 544      * be reached (due to {@code b} not having a {@code c} property,
 545      * {@code b} being {@code null}, or {@code c} not being the right type etc.).
 546      * <p>
 547      * All classes and properties used in a select-binding have to be public.





 548      *

 549      * If root has JavaFX properties, this call is equivalent to {@link #select(javafx.beans.value.ObservableValue, java.lang.String[])},
 550      * with the {@code root} and {@code step[0]} being substituted with the relevant property object.

 551      *
 552      * @param <T> the type of the wrapped {@code Object}
 553      * @param root
 554      *            The root bean.
 555      * @param steps
 556      *            The property names to reach the final property. The first step
 557      *            must be specified as it marks the property of the root bean.
 558      * @return the created {@link ObjectBinding}
 559      * @since JavaFX 8.0
 560      */
 561     public static <T> ObjectBinding<T> select(Object root, String... steps) {
 562         return new SelectBinding.AsObject<T>(root, steps);
 563     }
 564 
 565     /**
 566      * Creates a binding used to get a member, such as {@code a.b.c}. The value
 567      * of the binding will be {@code c}, or {@code 0.0} if {@code c} could not
 568      * be reached (due to {@code b} not having a {@code c} property,
 569      * {@code b} being {@code null}, or {@code c} not being a {@code Number} etc.).
 570      * <p>
 571      * All classes and properties used in a select-binding have to be public.





 572      *

 573      * If root has JavaFX properties, this call is equivalent to {@link #selectDouble(javafx.beans.value.ObservableValue, java.lang.String[])},
 574      * with the {@code root} and {@code step[0]} being substituted with the relevant property object.

 575      *
 576      * @param root
 577      *            The root bean.
 578      * @param steps
 579      *            The property names to reach the final property. The first step
 580      *            must be specified as it marks the property of the root bean.
 581      * @return the created {@link DoubleBinding}
 582      * @since JavaFX 8.0
 583      */
 584     public static DoubleBinding selectDouble(Object root, String... steps) {
 585         return new SelectBinding.AsDouble(root, steps);
 586     }
 587 
 588     /**
 589      * Creates a binding used to get a member, such as {@code a.b.c}. The value
 590      * of the binding will be {@code c}, or {@code 0.0f} if {@code c} could not
 591      * be reached (due to {@code b} not having a {@code c} property,
 592      * {@code b} being {@code null}, or {@code c} not being a {@code Number} etc.).
 593      * <p>
 594      * All classes and properties used in a select-binding have to be public.





 595      *

 596      * If root has JavaFX properties, this call is equivalent to {@link #selectFloat(javafx.beans.value.ObservableValue, java.lang.String[])},
 597      * with the {@code root} and {@code step[0]} being substituted with the relevant property object.

 598      *
 599      * @param root
 600      *            The root bean.
 601      * @param steps
 602      *            The property names to reach the final property. The first step
 603      *            must be specified as it marks the property of the root bean.
 604      * @return the created {@link FloatBinding}
 605      * @since JavaFX 8.0
 606      */
 607     public static FloatBinding selectFloat(Object root, String... steps) {
 608         return new SelectBinding.AsFloat(root, steps);
 609     }
 610 
 611     /**
 612      * Creates a binding used to get a member, such as {@code a.b.c}. The value
 613      * of the binding will be {@code c}, or {@code 0} if {@code c} could not
 614      * be reached (due to {@code b} not having a {@code c} property,
 615      * {@code b} being {@code null}, or {@code c} not being a {@code Number} etc.).
 616      * <p>
 617      * All classes and properties used in a select-binding have to be public.





 618      *

 619      * If root has JavaFX properties, this call is equivalent to {@link #selectInteger(javafx.beans.value.ObservableValue, java.lang.String[])},
 620      * with the {@code root} and {@code step[0]} being substituted with the relevant property object.

 621      *
 622      * @param root
 623      *            The root bean.
 624      * @param steps
 625      *            The property names to reach the final property. The first step
 626      *            must be specified as it marks the property of the root bean.
 627      * @return the created {@link IntegerBinding}
 628      * @since JavaFX 8.0
 629      */
 630     public static IntegerBinding selectInteger(Object root, String... steps) {
 631         return new SelectBinding.AsInteger(root, steps);
 632     }
 633 
 634     /**
 635      * Creates a binding used to get a member, such as {@code a.b.c}. The value
 636      * of the binding will be {@code c}, or {@code 0L} if {@code c} could not
 637      * be reached (due to {@code b} not having a {@code c} property,
 638      * {@code b} being {@code null}, or {@code c} not being a {@code Number} etc.).
 639      * <p>
 640      * All classes and properties used in a select-binding have to be public.





 641      *

 642      * If root has JavaFX properties, this call is equivalent to {@link #selectLong(javafx.beans.value.ObservableValue, java.lang.String[])},
 643      * with the {@code root} and {@code step[0]} being substituted with the relevant property object.

 644      *
 645      * @param root
 646      *            The root bean.
 647      * @param steps
 648      *            The property names to reach the final property. The first step
 649      *            must be specified as it marks the property of the root bean.
 650      * @return the created {@link LongBinding}
 651      * @since JavaFX 8.0
 652      */
 653     public static LongBinding selectLong(Object root, String... steps) {
 654         return new SelectBinding.AsLong(root, steps);
 655     }
 656 
 657     /**
 658      * Creates a binding used to get a member, such as {@code a.b.c}. The value
 659      * of the binding will be {@code c}, or {@code false} if {@code c} could not
 660      * be reached (due to {@code b} not having a {@code c} property,
 661      * {@code b} being {@code null}, or {@code c} not being a {@code boolean} etc.).
 662      * <p>
 663      * All classes and properties used in a select-binding have to be public.





 664      *

 665      * If root has JavaFX properties, this call is equivalent to {@link #selectBoolean(javafx.beans.value.ObservableValue, java.lang.String[])},
 666      * with the {@code root} and {@code step[0]} being substituted with the relevant property object.

 667      *
 668      * @param root
 669      *            The root bean.
 670      * @param steps
 671      *            The property names to reach the final property. The first step
 672      *            must be specified as it marks the property of the root bean.
 673      * @return the created {@link ObjectBinding}
 674      * @since JavaFX 8.0
 675      */
 676     public static BooleanBinding selectBoolean(Object root, String... steps) {
 677         return new SelectBinding.AsBoolean(root, steps);
 678     }
 679 
 680     /**
 681      * Creates a binding used to get a member, such as {@code a.b.c}. The value
 682      * of the binding will be {@code c}, or {@code ""} if {@code c} could not
 683      * be reached (due to {@code b} not having a {@code c} property,
 684      * {@code b} being {@code null}, or {@code c} not being a {@code String} etc.).
 685      * <p>
 686      * All classes and properties used in a select-binding have to be public.





 687      *

 688      * If root has JavaFX properties, this call is equivalent to {@link #selectString(javafx.beans.value.ObservableValue, java.lang.String[])},
 689      * with the {@code root} and {@code step[0]} being substituted with the relevant property object.

 690      *
 691      * @param root
 692      *            The root bean.
 693      * @param steps
 694      *            The property names to reach the final property. The first step
 695      *            must be specified as it marks the property of the root bean.
 696      * @return the created {@link ObjectBinding}
 697      * @since JavaFX 8.0
 698      */
 699     public static StringBinding selectString(Object root, String... steps) {
 700         return new SelectBinding.AsString(root, steps);
 701     }
 702 
 703     /**
 704      * Creates a binding that calculates the result of a ternary expression. See
 705      * the description of class {@link When} for details.
 706      *
 707      * @see When
 708      *
 709      * @param condition




  80  * <p>
  81  * Or using only factory methods in Bindings:
  82  * <p>
  83  * {@code NumberBinding result = add (multiply(a, b), multiply(c,d));}
  84  * <p>
  85  * Or mixing both possibilities:
  86  * <p>
  87  * {@code NumberBinding result = add (a.multiply(b), c.multiply(d));}
  88  * <p>
  89  * The main difference between using the Fluent API and using the factory
  90  * methods in this class is that the Fluent API requires that at least one of
  91  * the operands is an Expression (see {@link javafx.beans.binding}). (Every
  92  * Expression contains a static method that generates an Expression from an
  93  * {@link javafx.beans.value.ObservableValue}.)
  94  * <p>
  95  * Also if you watched closely, you might have noticed that the return type of
  96  * the Fluent API is different in the examples above. In a lot of cases the
  97  * Fluent API allows to be more specific about the returned type (see
  98  * {@link javafx.beans.binding.NumberExpression} for more details about implicit
  99  * casting.
 100  * </p>
 101  * <p><a id="DeployAppAsModule"></a><b>Deploying an Application as a Module</b></p>
 102  * <p>
 103  * If any class used in a select-binding (see the various {@code select*}
 104  * methods) is in a named module, then it must be reflectively accessible to the
 105  * {@code javafx.base} module.
 106  * A class is reflectively accessible if the module
 107  * {@link Module#isOpen(String,Module) opens} the containing package to at
 108  * least the {@code javafx.base} module.
 109  * </p>
 110  * <p>
 111  * For example, if {@code com.foo.MyClass} is in the {@code foo.app} module,
 112  * the {@code module-info.java} might
 113  * look like this:
 114  * </p>
 115  *
 116 <pre>{@code module foo.app {
 117     opens com.foo to javafx.base;
 118 }}</pre>
 119  *
 120  * <p>
 121  * Alternatively, a class is reflectively accessible if the module
 122  * {@link Module#isExported(String) exports} the containing package
 123  * unconditionally.
 124  * </p>
 125  *
 126  * @see Binding
 127  * @see NumberBinding
 128  *
 129  *
 130  * @since JavaFX 2.0
 131  */
 132 public final class Bindings {
 133 
 134     private Bindings() {
 135     }
 136 
 137     // =================================================================================================================
 138     // Helper functions to create custom bindings
 139 
 140     /**
 141      * Helper function to create a custom {@link BooleanBinding}.
 142      *
 143      * @param func The function that calculates the value of this binding
 144      * @param dependencies The dependencies of this binding


 411             public ObservableList<?> getDependencies() {
 412                 return  ((dependencies == null) || (dependencies.length == 0))?
 413                             FXCollections.emptyObservableList()
 414                         : (dependencies.length == 1)?
 415                             FXCollections.singletonObservableList(dependencies[0])
 416                         : new ImmutableObservableList<Observable>(dependencies);
 417             }
 418         };
 419     }
 420 
 421 
 422     // =================================================================================================================
 423     // Select Bindings
 424 
 425     /**
 426      * Creates a binding used to get a member, such as {@code a.b.c}. The value
 427      * of the binding will be {@code c}, or {@code null} if {@code c} could not
 428      * be reached (due to {@code b} not having a {@code c} property,
 429      * {@code b} being {@code null}, or {@code c} not being the right type etc.).
 430      * <p>
 431      * All classes and properties used in a select-binding have to be
 432      * declared public.
 433      * Additionally, if any class is in a named module, then it must be
 434      * reflectively accessible to the {@code javafx.base} module (see
 435      * <a href="#DeployAppAsModule">Deploying an Application as a Module</a>).
 436      * </p>
 437      * <p>
 438      * Note: since 8.0, JavaBeans properties are supported and might be in the chain.
 439      * </p>
 440      *
 441      * @param <T> the type of the wrapped {@code Object}
 442      * @param root
 443      *            The root {@link javafx.beans.value.ObservableValue}
 444      * @param steps
 445      *            The property names to reach the final property
 446      * @return the created {@link ObjectBinding}
 447      */
 448     public static <T> ObjectBinding<T> select(ObservableValue<?> root, String... steps) {
 449         return new SelectBinding.AsObject<T>(root, steps);
 450     }
 451 
 452     /**
 453      * Creates a binding used to get a member, such as {@code a.b.c}. The value
 454      * of the binding will be {@code c}, or {@code 0.0} if {@code c} could not
 455      * be reached (due to {@code b} not having a {@code c} property,
 456      * {@code b} being {@code null}, or {@code c} not being a {@code Number} etc.).
 457      * <p>
 458      * All classes and properties used in a select-binding have to be
 459      * declared public.
 460      * Additionally, if any class is in a named module, then it must be
 461      * reflectively accessible to the {@code javafx.base} module (see
 462      * <a href="#DeployAppAsModule">Deploying an Application as a Module</a>).
 463      * </p>
 464      * <p>
 465      * Note: since 8.0, JavaBeans properties are supported and might be in the chain.
 466      * </p>
 467      *
 468      * @param root
 469      *            The root {@link javafx.beans.value.ObservableValue}
 470      * @param steps
 471      *            The property names to reach the final property
 472      * @return the created {@link DoubleBinding}
 473      */
 474     public static DoubleBinding selectDouble(ObservableValue<?> root, String... steps) {
 475         return new SelectBinding.AsDouble(root, steps);
 476     }
 477 
 478     /**
 479      * Creates a binding used to get a member, such as {@code a.b.c}. The value
 480      * of the binding will be {@code c}, or {@code 0.0f} if {@code c} could not
 481      * be reached (due to {@code b} not having a {@code c} property,
 482      * {@code b} being {@code null}, or {@code c} not being a {@code Number} etc.).
 483      * <p>
 484      * All classes and properties used in a select-binding have to be
 485      * declared public.
 486      * Additionally, if any class is in a named module, then it must be
 487      * reflectively accessible to the {@code javafx.base} module (see
 488      * <a href="#DeployAppAsModule">Deploying an Application as a Module</a>).
 489      * </p>
 490      * <p>
 491      * Note: since 8.0, JavaBeans properties are supported and might be in the chain.
 492      * </p>
 493      *
 494      * @param root
 495      *            The root {@link javafx.beans.value.ObservableValue}
 496      * @param steps
 497      *            The property names to reach the final property
 498      * @return the created {@link FloatBinding}
 499      */
 500     public static FloatBinding selectFloat(ObservableValue<?> root, String... steps) {
 501         return new SelectBinding.AsFloat(root, steps);
 502     }
 503 
 504     /**
 505      * Creates a binding used to get a member, such as {@code a.b.c}. The value
 506      * of the binding will be {@code c}, or {@code 0} if {@code c} could not
 507      * be reached (due to {@code b} not having a {@code c} property,
 508      * {@code b} being {@code null}, or {@code c} not being a {@code Number} etc.).
 509      * <p>
 510      * All classes and properties used in a select-binding have to be
 511      * declared public.
 512      * Additionally, if any class is in a named module, then it must be
 513      * reflectively accessible to the {@code javafx.base} module (see
 514      * <a href="#DeployAppAsModule">Deploying an Application as a Module</a>).
 515      * </p>
 516      * <p>
 517      * Note: since 8.0, JavaBeans properties are supported and might be in the chain.
 518      * </p>
 519      *
 520      * @param root
 521      *            The root {@link javafx.beans.value.ObservableValue}
 522      * @param steps
 523      *            The property names to reach the final property
 524      * @return the created {@link IntegerBinding}
 525      */
 526     public static IntegerBinding selectInteger(ObservableValue<?> root, String... steps) {
 527         return new SelectBinding.AsInteger(root, steps);
 528     }
 529 
 530     /**
 531      * Creates a binding used to get a member, such as {@code a.b.c}. The value
 532      * of the binding will be {@code c}, or {@code 0L} if {@code c} could not
 533      * be reached (due to {@code b} not having a {@code c} property,
 534      * {@code b} being {@code null}, or {@code c} not being a {@code Number} etc.).
 535      * <p>
 536      * All classes and properties used in a select-binding have to be
 537      * declared public.
 538      * Additionally, if any class is in a named module, then it must be
 539      * reflectively accessible to the {@code javafx.base} module (see
 540      * <a href="#DeployAppAsModule">Deploying an Application as a Module</a>).
 541      * </p>
 542      * <p>
 543      * Note: since 8.0, JavaBeans properties are supported and might be in the chain.
 544      * </p>
 545      *
 546      * @param root
 547      *            The root {@link javafx.beans.value.ObservableValue}
 548      * @param steps
 549      *            The property names to reach the final property
 550      * @return the created {@link LongBinding}
 551      */
 552     public static LongBinding selectLong(ObservableValue<?> root, String... steps) {
 553         return new SelectBinding.AsLong(root, steps);
 554     }
 555 
 556     /**
 557      * Creates a binding used to get a member, such as {@code a.b.c}. The value
 558      * of the binding will be {@code c}, or {@code false} if {@code c} could not
 559      * be reached (due to {@code b} not having a {@code c} property,
 560      * {@code b} being {@code null}, or {@code c} not being a {@code boolean} etc.).
 561      * <p>
 562      * All classes and properties used in a select-binding have to be
 563      * declared public.
 564      * Additionally, if any class is in a named module, then it must be
 565      * reflectively accessible to the {@code javafx.base} module (see
 566      * <a href="#DeployAppAsModule">Deploying an Application as a Module</a>).
 567      * </p>
 568      * <p>
 569      * Note: since 8.0, JavaBeans properties are supported and might be in the chain.
 570      * </p>
 571      *
 572      * @param root
 573      *            The root {@link javafx.beans.value.ObservableValue}
 574      * @param steps
 575      *            The property names to reach the final property
 576      * @return the created {@link ObjectBinding}
 577      */
 578     public static BooleanBinding selectBoolean(ObservableValue<?> root, String... steps) {
 579         return new SelectBinding.AsBoolean(root, steps);
 580     }
 581 
 582     /**
 583      * Creates a binding used to get a member, such as {@code a.b.c}. The value
 584      * of the binding will be {@code c}, or {@code ""} if {@code c} could not
 585      * be reached (due to {@code b} not having a {@code c} property,
 586      * {@code b} being {@code null}, or {@code c} not being a {@code String} etc.).
 587      * <p>
 588      * All classes and properties used in a select-binding have to be
 589      * declared public.
 590      * Additionally, if any class is in a named module, then it must be
 591      * reflectively accessible to the {@code javafx.base} module (see
 592      * <a href="#DeployAppAsModule">Deploying an Application as a Module</a>).
 593      * </p>
 594      * <p>
 595      * Note: since 8.0, JavaBeans properties are supported and might be in the chain.
 596      * </p>
 597      *
 598      * @param root
 599      *            The root {@link javafx.beans.value.ObservableValue}
 600      * @param steps
 601      *            The property names to reach the final property
 602      * @return the created {@link ObjectBinding}
 603      */
 604     public static StringBinding selectString(ObservableValue<?> root, String... steps) {
 605         return new SelectBinding.AsString(root, steps);
 606     }
 607 
 608     /**
 609      * Creates a binding used to get a member, such as {@code a.b.c}. The value
 610      * of the binding will be {@code c}, or {@code null} if {@code c} could not
 611      * be reached (due to {@code b} not having a {@code c} property,
 612      * {@code b} being {@code null}, or {@code c} not being the right type etc.).
 613      * <p>
 614      * All classes and properties used in a select-binding have to be
 615      * declared public.
 616      * Additionally, if any class is in a named module, then it must be
 617      * reflectively accessible to the {@code javafx.base} module (see
 618      * <a href="#DeployAppAsModule">Deploying an Application as a Module</a>).
 619      * </p>
 620      *
 621      * <p>
 622      * If root has JavaFX properties, this call is equivalent to {@link #select(javafx.beans.value.ObservableValue, java.lang.String[])},
 623      * with the {@code root} and {@code step[0]} being substituted with the relevant property object.
 624      * </p>
 625      *
 626      * @param <T> the type of the wrapped {@code Object}
 627      * @param root
 628      *            The root bean.
 629      * @param steps
 630      *            The property names to reach the final property. The first step
 631      *            must be specified as it marks the property of the root bean.
 632      * @return the created {@link ObjectBinding}
 633      * @since JavaFX 8.0
 634      */
 635     public static <T> ObjectBinding<T> select(Object root, String... steps) {
 636         return new SelectBinding.AsObject<T>(root, steps);
 637     }
 638 
 639     /**
 640      * Creates a binding used to get a member, such as {@code a.b.c}. The value
 641      * of the binding will be {@code c}, or {@code 0.0} if {@code c} could not
 642      * be reached (due to {@code b} not having a {@code c} property,
 643      * {@code b} being {@code null}, or {@code c} not being a {@code Number} etc.).
 644      * <p>
 645      * All classes and properties used in a select-binding have to be
 646      * declared public.
 647      * Additionally, if any class is in a named module, then it must be
 648      * reflectively accessible to the {@code javafx.base} module (see
 649      * <a href="#DeployAppAsModule">Deploying an Application as a Module</a>).
 650      * </p>
 651      *
 652      * <p>
 653      * If root has JavaFX properties, this call is equivalent to {@link #selectDouble(javafx.beans.value.ObservableValue, java.lang.String[])},
 654      * with the {@code root} and {@code step[0]} being substituted with the relevant property object.
 655      * </p>
 656      *
 657      * @param root
 658      *            The root bean.
 659      * @param steps
 660      *            The property names to reach the final property. The first step
 661      *            must be specified as it marks the property of the root bean.
 662      * @return the created {@link DoubleBinding}
 663      * @since JavaFX 8.0
 664      */
 665     public static DoubleBinding selectDouble(Object root, String... steps) {
 666         return new SelectBinding.AsDouble(root, steps);
 667     }
 668 
 669     /**
 670      * Creates a binding used to get a member, such as {@code a.b.c}. The value
 671      * of the binding will be {@code c}, or {@code 0.0f} if {@code c} could not
 672      * be reached (due to {@code b} not having a {@code c} property,
 673      * {@code b} being {@code null}, or {@code c} not being a {@code Number} etc.).
 674      * <p>
 675      * All classes and properties used in a select-binding have to be
 676      * declared public.
 677      * Additionally, if any class is in a named module, then it must be
 678      * reflectively accessible to the {@code javafx.base} module (see
 679      * <a href="#DeployAppAsModule">Deploying an Application as a Module</a>).
 680      * </p>
 681      *
 682      * <p>
 683      * If root has JavaFX properties, this call is equivalent to {@link #selectFloat(javafx.beans.value.ObservableValue, java.lang.String[])},
 684      * with the {@code root} and {@code step[0]} being substituted with the relevant property object.
 685      * </p>
 686      *
 687      * @param root
 688      *            The root bean.
 689      * @param steps
 690      *            The property names to reach the final property. The first step
 691      *            must be specified as it marks the property of the root bean.
 692      * @return the created {@link FloatBinding}
 693      * @since JavaFX 8.0
 694      */
 695     public static FloatBinding selectFloat(Object root, String... steps) {
 696         return new SelectBinding.AsFloat(root, steps);
 697     }
 698 
 699     /**
 700      * Creates a binding used to get a member, such as {@code a.b.c}. The value
 701      * of the binding will be {@code c}, or {@code 0} if {@code c} could not
 702      * be reached (due to {@code b} not having a {@code c} property,
 703      * {@code b} being {@code null}, or {@code c} not being a {@code Number} etc.).
 704      * <p>
 705      * All classes and properties used in a select-binding have to be
 706      * declared public.
 707      * Additionally, if any class is in a named module, then it must be
 708      * reflectively accessible to the {@code javafx.base} module (see
 709      * <a href="#DeployAppAsModule">Deploying an Application as a Module</a>).
 710      * </p>
 711      *
 712      * <p>
 713      * If root has JavaFX properties, this call is equivalent to {@link #selectInteger(javafx.beans.value.ObservableValue, java.lang.String[])},
 714      * with the {@code root} and {@code step[0]} being substituted with the relevant property object.
 715      * </p>
 716      *
 717      * @param root
 718      *            The root bean.
 719      * @param steps
 720      *            The property names to reach the final property. The first step
 721      *            must be specified as it marks the property of the root bean.
 722      * @return the created {@link IntegerBinding}
 723      * @since JavaFX 8.0
 724      */
 725     public static IntegerBinding selectInteger(Object root, String... steps) {
 726         return new SelectBinding.AsInteger(root, steps);
 727     }
 728 
 729     /**
 730      * Creates a binding used to get a member, such as {@code a.b.c}. The value
 731      * of the binding will be {@code c}, or {@code 0L} if {@code c} could not
 732      * be reached (due to {@code b} not having a {@code c} property,
 733      * {@code b} being {@code null}, or {@code c} not being a {@code Number} etc.).
 734      * <p>
 735      * All classes and properties used in a select-binding have to be
 736      * declared public.
 737      * Additionally, if any class is in a named module, then it must be
 738      * reflectively accessible to the {@code javafx.base} module (see
 739      * <a href="#DeployAppAsModule">Deploying an Application as a Module</a>).
 740      * </p>
 741      *
 742      * <p>
 743      * If root has JavaFX properties, this call is equivalent to {@link #selectLong(javafx.beans.value.ObservableValue, java.lang.String[])},
 744      * with the {@code root} and {@code step[0]} being substituted with the relevant property object.
 745      * </p>
 746      *
 747      * @param root
 748      *            The root bean.
 749      * @param steps
 750      *            The property names to reach the final property. The first step
 751      *            must be specified as it marks the property of the root bean.
 752      * @return the created {@link LongBinding}
 753      * @since JavaFX 8.0
 754      */
 755     public static LongBinding selectLong(Object root, String... steps) {
 756         return new SelectBinding.AsLong(root, steps);
 757     }
 758 
 759     /**
 760      * Creates a binding used to get a member, such as {@code a.b.c}. The value
 761      * of the binding will be {@code c}, or {@code false} if {@code c} could not
 762      * be reached (due to {@code b} not having a {@code c} property,
 763      * {@code b} being {@code null}, or {@code c} not being a {@code boolean} etc.).
 764      * <p>
 765      * All classes and properties used in a select-binding have to be
 766      * declared public.
 767      * Additionally, if any class is in a named module, then it must be
 768      * reflectively accessible to the {@code javafx.base} module (see
 769      * <a href="#DeployAppAsModule">Deploying an Application as a Module</a>).
 770      * </p>
 771      *
 772      * <p>
 773      * If root has JavaFX properties, this call is equivalent to {@link #selectBoolean(javafx.beans.value.ObservableValue, java.lang.String[])},
 774      * with the {@code root} and {@code step[0]} being substituted with the relevant property object.
 775      * </p>
 776      *
 777      * @param root
 778      *            The root bean.
 779      * @param steps
 780      *            The property names to reach the final property. The first step
 781      *            must be specified as it marks the property of the root bean.
 782      * @return the created {@link ObjectBinding}
 783      * @since JavaFX 8.0
 784      */
 785     public static BooleanBinding selectBoolean(Object root, String... steps) {
 786         return new SelectBinding.AsBoolean(root, steps);
 787     }
 788 
 789     /**
 790      * Creates a binding used to get a member, such as {@code a.b.c}. The value
 791      * of the binding will be {@code c}, or {@code ""} if {@code c} could not
 792      * be reached (due to {@code b} not having a {@code c} property,
 793      * {@code b} being {@code null}, or {@code c} not being a {@code String} etc.).
 794      * <p>
 795      * All classes and properties used in a select-binding have to be
 796      * declared public.
 797      * Additionally, if any class is in a named module, then it must be
 798      * reflectively accessible to the {@code javafx.base} module (see
 799      * <a href="#DeployAppAsModule">Deploying an Application as a Module</a>).
 800      * </p>
 801      *
 802      * <p>
 803      * If root has JavaFX properties, this call is equivalent to {@link #selectString(javafx.beans.value.ObservableValue, java.lang.String[])},
 804      * with the {@code root} and {@code step[0]} being substituted with the relevant property object.
 805      * </p>
 806      *
 807      * @param root
 808      *            The root bean.
 809      * @param steps
 810      *            The property names to reach the final property. The first step
 811      *            must be specified as it marks the property of the root bean.
 812      * @return the created {@link ObjectBinding}
 813      * @since JavaFX 8.0
 814      */
 815     public static StringBinding selectString(Object root, String... steps) {
 816         return new SelectBinding.AsString(root, steps);
 817     }
 818 
 819     /**
 820      * Creates a binding that calculates the result of a ternary expression. See
 821      * the description of class {@link When} for details.
 822      *
 823      * @see When
 824      *
 825      * @param condition


< prev index next >