Skip to content

Commit 406a69e

Browse files
author
nicolaiparlog
committed
Finished Javadoc.
1 parent 50adc1f commit 406a69e

31 files changed

+220
-100
lines changed

src/org/codefx/libfx/nesting/AbstractNestingBuilderOnObservable.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
* nesting steps) and can build a {@link Nesting} from it.
1818
* <p>
1919
* Subclasses must not allow nesting if type parameter {@code O} does not also implement {@link ObservableValue}! (Which
20-
* wouldn't make sense, anyhow, because then no value would be available for the nesting step.)
20+
* wouldn't make sense anyhow because then no value would be available for the nesting step.)
2121
*
2222
* @param <T>
2323
* the type of the wrapped value
2424
* @param <O>
25-
* the type of observable this builder can build;
25+
* the type of {@link Observable} this builder uses as an inner observable
2626
*/
2727
abstract class AbstractNestingBuilderOnObservable<T, O extends Observable> {
2828

src/org/codefx/libfx/nesting/AbstractNestingBuilderOnObservableValue.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.codefx.libfx.nesting;
22

3+
import javafx.beans.Observable;
34
import javafx.beans.value.ChangeListener;
45
import javafx.beans.value.ObservableValue;
56

@@ -12,7 +13,7 @@
1213
* @param <T>
1314
* the type of the wrapped value
1415
* @param <O>
15-
* the type of observable this builder can build
16+
* the type of {@link Observable} this builder uses as an inner observable
1617
*/
1718
abstract class AbstractNestingBuilderOnObservableValue<T, O extends ObservableValue<T>>
1819
extends AbstractNestingBuilderOnObservable<T, O> {

src/org/codefx/libfx/nesting/AbstractNestingBuilderOnProperty.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.codefx.libfx.nesting;
22

3+
import javafx.beans.Observable;
34
import javafx.beans.property.Property;
45

56
/**
@@ -8,7 +9,7 @@
89
* @param <T>
910
* the type of the wrapped value
1011
* @param <O>
11-
* the type of observable this builder can build
12+
* the type of {@link Observable} this builder uses as an inner observable
1213
*/
1314
abstract class AbstractNestingBuilderOnProperty<T, O extends Property<T>>
1415
extends AbstractNestingBuilderOnObservableValue<T, O> {

src/org/codefx/libfx/nesting/BooleanPropertyNestingBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import org.codefx.libfx.nesting.property.NestedBooleanPropertyBuilder;
77

88
/**
9-
* A builder for all kinds of nested functionality whose innermost value is held by a {@link BooleanProperty}.
9+
* A builder for all kinds of nested functionality whose inner observable is a {@link BooleanProperty}.
1010
*/
1111
public class BooleanPropertyNestingBuilder extends AbstractNestingBuilderOnProperty<Boolean, BooleanProperty> {
1212

src/org/codefx/libfx/nesting/DeepNesting.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* the {@link #innerObservableProperty() innerObservable}.
1717
*
1818
* @param <O>
19-
* the hierarchy's innermost type of {@link Observable}
19+
* the type of the nesting hierarchy's inner {@link Observable}
2020
*/
2121
@SuppressWarnings("rawtypes")
2222
final class DeepNesting<O extends Observable> implements Nesting<O> {
@@ -26,9 +26,9 @@ final class DeepNesting<O extends Observable> implements Nesting<O> {
2626
/*
2727
* GENERIC TYPES
2828
*
29-
* Because the depth of the nesting is variable, the number of involved types is determined at runtime. This class
30-
* can hence not use generics for type safety. So it uses tons of raw types, which only works out if the
31-
* constructor is called with the correctly typed outer observable and nesting steps.
29+
* Because the depth of the nesting is not fixed, the number of involved types is determined at runtime. This class
30+
* can hence not use generics for type safety. So it uses tons of raw types, which only works out if the constructor
31+
* is called with the correctly typed outer observable and nesting steps.
3232
*
3333
*
3434
* DATA STRUCTURES
@@ -83,7 +83,7 @@ final class DeepNesting<O extends Observable> implements Nesting<O> {
8383
private final ChangeListener[] changeListeners;
8484

8585
/**
86-
* The property holding the current innermost observable.
86+
* The property holding the current inner observable.
8787
*/
8888
private final Property<Optional<O>> inner;
8989

src/org/codefx/libfx/nesting/DoublePropertyNestingBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import org.codefx.libfx.nesting.property.NestedDoublePropertyBuilder;
77

88
/**
9-
* A builder for all kinds of nested functionality whose innermost value is held by a {@link DoubleProperty}.
9+
* A builder for all kinds of nested functionality whose inner observable is a {@link DoubleProperty}.
1010
*/
1111
public class DoublePropertyNestingBuilder extends AbstractNestingBuilderOnProperty<Number, DoubleProperty> {
1212

src/org/codefx/libfx/nesting/FloatPropertyNestingBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import org.codefx.libfx.nesting.property.NestedFloatPropertyBuilder;
77

88
/**
9-
* A builder for all kinds of nested functionality whose innermost value is held by a {@link FloatProperty}.
9+
* A builder for all kinds of nested functionality whose inner observable is a {@link FloatProperty}.
1010
*/
1111
public class FloatPropertyNestingBuilder extends AbstractNestingBuilderOnProperty<Number, FloatProperty> {
1212

src/org/codefx/libfx/nesting/IntegerPropertyNestingBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import org.codefx.libfx.nesting.property.NestedIntegerPropertyBuilder;
77

88
/**
9-
* A builder for all kinds of nested functionality whose innermost value is held by an {@link IntegerProperty}.
9+
* A builder for all kinds of nested functionality whose inner observable is an {@link IntegerProperty}.
1010
*/
1111
public class IntegerPropertyNestingBuilder extends AbstractNestingBuilderOnProperty<Number, IntegerProperty> {
1212

src/org/codefx/libfx/nesting/LongPropertyNestingBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import org.codefx.libfx.nesting.property.NestedLongPropertyBuilder;
77

88
/**
9-
* A builder for all kinds of nested functionality whose innermost value is held by a {@link LongProperty}.
9+
* A builder for all kinds of nested functionality whose inner observable is a {@link LongProperty}.
1010
*/
1111
public class LongPropertyNestingBuilder extends AbstractNestingBuilderOnProperty<Number, LongProperty> {
1212

src/org/codefx/libfx/nesting/Nesting.java

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,55 @@
77
import javafx.beans.value.ObservableValue;
88

99
/**
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.
1414
* <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.
1647
*
48+
* @see Nestings
1749
* @param <O>
18-
* the type of the hierarchy's innermost {@link Observable}
50+
* the type of the nesting hierarchy's inner {@link Observable}
1951
*/
2052
public interface Nesting<O extends Observable> {
2153

2254
/**
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()}.
2557
*
26-
* @return the innermost {@link ObservableValue} in an {@link Optional}
58+
* @return the inner {@link Observable} in an {@link Optional}
2759
*/
2860
ReadOnlyProperty<Optional<O>> innerObservableProperty();
2961

0 commit comments

Comments
 (0)