|
7 | 7 | import javafx.beans.value.ObservableValue;
|
8 | 8 |
|
9 | 9 | /**
|
10 |
| - * A nesting encapsulates a hierarchy of nested {@link ObservableValue ObservableValues}; its |
11 |
| - * {@link #innerObservableProperty() innerObservable} property always contains the current innermost {@link Observable} |
12 |
| - * in that hierarchy as an {@link Optional}. If some observable or its value were null, {@code innerObservableProperty} |
13 |
| - * contains {@link Optional#empty()}. |
| 10 | + * A nesting encapsulates a hierarchy of nested {@link ObservableValue ObservableValues} and its |
| 11 | + * {@link #innerObservableProperty() innerObservable} property always contains the current innermost {@code Observable} |
| 12 | + * in that hierarchy as an {@link Optional}. A {@code Nesting} can be used as a basic building block for other nested |
| 13 | + * functionality. |
14 | 14 | * <p>
|
15 |
| - * Nestings will usually be implemented such that they eagerly evaluate the nested observables. |
| 15 | + * <h2>Nesting Hierarchy</h2> A nesting hierarchy is composed of some {@code ObservableValues}, often simply called |
| 16 | + * <b>observables</b>, and <b>nesting steps</b> which lead from one observable to the next. |
| 17 | + * <p> |
| 18 | + * At the top of the hierarchy stands one of the observables, the so called <b>outer observable</b>. A nesting step will |
| 19 | + * use its value to return the next observable. The next step will use that observable's value to return the next |
| 20 | + * observable and so on. All observables returned by nesting steps are called <b>nested observables</b>. Finally and |
| 21 | + * perhaps most importantly, the last step will lead to the hierarchy's <b>inner observable</b>. |
| 22 | + * <p> |
| 23 | + * As nesting steps require a value to be accessible, all observables on which a step is used must provide a value. |
| 24 | + * Hence they must all implement {@link ObservableValue} (of {@code T}, where {@code T} is no primitive type wrapper or |
| 25 | + * {@code String}). No step is used on the inner observable so it suffices that it implements {@link Observable}. |
| 26 | + * <p> |
| 27 | + * <h3>Example</h3> Consider a class {@code Employee} which has an {@code Property<Address> address}, where |
| 28 | + * {@code Address} has a {@code StringProperty streetName}. There might be a {@code Property<Emplyee> currentEmployee}, |
| 29 | + * which always holds the current employee. |
| 30 | + * <p> |
| 31 | + * In this case the hierarchy would be {@code currentEmployee -> address -> streetName} where {@code currentEmployee} is |
| 32 | + * the outer observable and {@code address} and {@code streetName} are nested observables. Additionally, |
| 33 | + * {@code streetName} is the inner observable. |
| 34 | + * <p> |
| 35 | + * <h2>Present or Missing Inner Observable</h2> If all steps return non-null observables and none of them contains null, |
| 36 | + * the inner observable can be computed and will be contained in the {@link #innerObservableProperty() innerObservable} |
| 37 | + * property. In this case it is said to be <b>present</b>. The same is true if only the inner observable contains null. |
| 38 | + * <p> |
| 39 | + * If any nesting step returns null or any observable except the inner contains null as a value, the nesting hierarchy |
| 40 | + * can not be completely computed. The inner observable is said to be <b>missing</b> and the {@code innerObservable} |
| 41 | + * property contains {@link Optional#empty()}. |
| 42 | + * <p> |
| 43 | + * <h2>Evaluation</h2> Nestings will usually be implemented such that they eagerly evaluate the nested observables. |
| 44 | + * <p> |
| 45 | + * <h2>Build</h2> Instances of {@code Nesting} can be created with dedicated builders. These can be obtained by starting |
| 46 | + * with one of the methods in {@link Nestings}. More details can be found there. |
16 | 47 | *
|
| 48 | + * @see Nestings |
17 | 49 | * @param <O>
|
18 |
| - * the type of the hierarchy's innermost {@link Observable} |
| 50 | + * the type of the nesting hierarchy's inner {@link Observable} |
19 | 51 | */
|
20 | 52 | public interface Nesting<O extends Observable> {
|
21 | 53 |
|
22 | 54 | /**
|
23 |
| - * A property holding the current innermost observable in the hierarchy as an optional. If some observable or its |
24 |
| - * value were null, this contains {@link Optional#empty()}. |
| 55 | + * A property holding the current inner observable in the hierarchy as an optional. If some observable or its value |
| 56 | + * were null, this contains {@link Optional#empty()}. |
25 | 57 | *
|
26 |
| - * @return the innermost {@link ObservableValue} in an {@link Optional} |
| 58 | + * @return the inner {@link Observable} in an {@link Optional} |
27 | 59 | */
|
28 | 60 | ReadOnlyProperty<Optional<O>> innerObservableProperty();
|
29 | 61 |
|
|
0 commit comments