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