Skip to content

Commit 82fb72c

Browse files
author
nicolaiparlog
committed
Restructured inheritance of nesting builders.
1 parent 8a7217e commit 82fb72c

15 files changed

+515
-216
lines changed

src/org/codefx/libfx/nesting/AbstractNestingBuilder.java renamed to src/org/codefx/libfx/nesting/AbstractNestingBuilderOnObservable.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* @param <O>
2121
* the type of observable this builder can build;
2222
*/
23-
abstract class AbstractNestingBuilder<T, O extends Observable> {
23+
abstract class AbstractNestingBuilderOnObservable<T, O extends Observable> {
2424

2525
/*
2626
* A builder can either be the outer or a nested builder of a nesting. In the first case, 'outerObservable' is
@@ -40,7 +40,7 @@ abstract class AbstractNestingBuilder<T, O extends Observable> {
4040
* The previous builder upon which this builder depends. This is only non-null for nested builders (indicated by
4141
* {@link #isOuterBuilder()}).
4242
*/
43-
private final AbstractNestingBuilder<?, ?> previousBuilder;
43+
private final AbstractNestingBuilderOnObservable<?, ?> previousBuilder;
4444

4545
/**
4646
* The function which performs the {@link NestingStep} from an instance of the previous builder's wrapped type to
@@ -58,7 +58,7 @@ abstract class AbstractNestingBuilder<T, O extends Observable> {
5858
* @param outerObservable
5959
* the outer observable upon which the constructed nesting depends
6060
*/
61-
protected AbstractNestingBuilder(O outerObservable) {
61+
protected AbstractNestingBuilderOnObservable(O outerObservable) {
6262
Objects.requireNonNull(outerObservable, "The argument 'outerObservable' must not be null.");
6363

6464
this.outerObservable = outerObservable;
@@ -77,8 +77,8 @@ protected AbstractNestingBuilder(O outerObservable) {
7777
* @param nestingStep
7878
* the function which performs the nesting step from one observable to the next
7979
*/
80-
protected <P> AbstractNestingBuilder(
81-
AbstractNestingBuilder<P, ?> previousBuilder, NestingStep<P, ? extends O> nestingStep) {
80+
protected <P> AbstractNestingBuilderOnObservable(
81+
AbstractNestingBuilderOnObservable<P, ?> previousBuilder, NestingStep<P, ? extends O> nestingStep) {
8282

8383
Objects.requireNonNull(previousBuilder, "The argument 'previousBuilder' must not be null.");
8484
Objects.requireNonNull(nestingStep, "The argument 'nestingStep' must not be null.");
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package org.codefx.libfx.nesting;
2+
3+
import javafx.beans.value.ObservableValue;
4+
5+
/**
6+
* A nesting builder which allows adding change listeners.
7+
*
8+
* @param <T>
9+
* the type of the wrapped value
10+
* @param <O>
11+
* the type of observable this builder can build
12+
*/
13+
abstract class AbstractNestingBuilderOnObservableValue<T, O extends ObservableValue<T>>
14+
extends AbstractNestingBuilderOnObservable<T, O> {
15+
16+
// #region CONSTRUCTION
17+
18+
/**
19+
* Creates a new nesting builder which acts as the outer builder.
20+
*
21+
* @param outerObservable
22+
* the outer observable upon which the constructed nesting depends
23+
*/
24+
protected AbstractNestingBuilderOnObservableValue(O outerObservable) {
25+
super(outerObservable);
26+
}
27+
28+
/**
29+
* Creates a new nesting builder which acts as a nested builder.
30+
*
31+
* @param <P>
32+
* the type the previous builder wraps
33+
* @param previousNestedBuilder
34+
* the previous builder
35+
* @param nestingStep
36+
* the function which performs the nesting step from one observable to the next
37+
*/
38+
protected <P> AbstractNestingBuilderOnObservableValue(
39+
AbstractNestingBuilderOnObservable<P, ?> previousNestedBuilder, NestingStep<P, O> nestingStep) {
40+
41+
super(previousNestedBuilder, nestingStep);
42+
}
43+
44+
//#end CONSTRUCTION
45+
46+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package org.codefx.libfx.nesting;
2+
3+
import javafx.beans.property.Property;
4+
5+
/**
6+
* A nesting builder which allows bindings.
7+
*
8+
* @param <T>
9+
* the type of the wrapped value
10+
* @param <O>
11+
* the type of observable this builder can build
12+
*/
13+
abstract class AbstractNestingBuilderOnProperty<T, O extends Property<T>>
14+
extends AbstractNestingBuilderOnObservableValue<T, O> {
15+
16+
// #region CONSTRUCTION
17+
18+
/**
19+
* Creates a new nesting builder which acts as the outer builder.
20+
*
21+
* @param outerObservable
22+
* the outer observable upon which the constructed nesting depends
23+
*/
24+
protected AbstractNestingBuilderOnProperty(O outerObservable) {
25+
super(outerObservable);
26+
}
27+
28+
/**
29+
* Creates a new nesting builder which acts as a nested builder.
30+
*
31+
* @param <P>
32+
* the type the previous builder wraps
33+
* @param previousNestedBuilder
34+
* the previous builder
35+
* @param nestingStep
36+
* the function which performs the nesting step from one observable to the next
37+
*/
38+
protected <P> AbstractNestingBuilderOnProperty(
39+
AbstractNestingBuilderOnObservable<P, ?> previousNestedBuilder, NestingStep<P, O> nestingStep) {
40+
41+
super(previousNestedBuilder, nestingStep);
42+
}
43+
44+
//#end CONSTRUCTION
45+
46+
}

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

Lines changed: 0 additions & 185 deletions
This file was deleted.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/**
99
* A builder for all kinds of nested functionality whose innermost value is held by a {@link BooleanProperty}.
1010
*/
11-
public class BooleanPropertyNestingBuilder extends AbstractNestingBuilder<Boolean, BooleanProperty> {
11+
public class BooleanPropertyNestingBuilder extends AbstractNestingBuilderOnProperty<Boolean, BooleanProperty> {
1212

1313
// #region CONSTRUCTION
1414

@@ -23,7 +23,7 @@ public class BooleanPropertyNestingBuilder extends AbstractNestingBuilder<Boolea
2323
* the function which performs the nesting step from one observable to the next
2424
*/
2525
<P> BooleanPropertyNestingBuilder(
26-
AbstractNestingBuilder<P, ?> previousNestedBuilder,
26+
AbstractNestingBuilderOnObservableValue<P, ?> previousNestedBuilder,
2727
NestingStep<P, BooleanProperty> nestingStep) {
2828

2929
super(previousNestedBuilder, nestingStep);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/**
99
* A builder for all kinds of nested functionality whose innermost value is held by a {@link DoubleProperty}.
1010
*/
11-
public class DoublePropertyNestingBuilder extends AbstractNestingBuilder<Number, DoubleProperty> {
11+
public class DoublePropertyNestingBuilder extends AbstractNestingBuilderOnProperty<Number, DoubleProperty> {
1212

1313
// #region CONSTRUCTION
1414

@@ -23,7 +23,7 @@ public class DoublePropertyNestingBuilder extends AbstractNestingBuilder<Number,
2323
* the function which performs the nesting step from one observable to the next
2424
*/
2525
<P> DoublePropertyNestingBuilder(
26-
AbstractNestingBuilder<P, ?> previousNestedBuilder,
26+
AbstractNestingBuilderOnObservableValue<P, ?> previousNestedBuilder,
2727
NestingStep<P, DoubleProperty> nestingStep) {
2828

2929
super(previousNestedBuilder, nestingStep);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/**
99
* A builder for all kinds of nested functionality whose innermost value is held by a {@link FloatProperty}.
1010
*/
11-
public class FloatPropertyNestingBuilder extends AbstractNestingBuilder<Number, FloatProperty> {
11+
public class FloatPropertyNestingBuilder extends AbstractNestingBuilderOnProperty<Number, FloatProperty> {
1212

1313
// #region CONSTRUCTION
1414

@@ -23,7 +23,7 @@ public class FloatPropertyNestingBuilder extends AbstractNestingBuilder<Number,
2323
* the function which performs the nesting step from one observable to the next
2424
*/
2525
<P> FloatPropertyNestingBuilder(
26-
AbstractNestingBuilder<P, ?> previousNestedBuilder,
26+
AbstractNestingBuilderOnObservableValue<P, ?> previousNestedBuilder,
2727
NestingStep<P, FloatProperty> nestingStep) {
2828

2929
super(previousNestedBuilder, nestingStep);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/**
99
* A builder for all kinds of nested functionality whose innermost value is held by an {@link IntegerProperty}.
1010
*/
11-
public class IntegerPropertyNestingBuilder extends AbstractNestingBuilder<Number, IntegerProperty> {
11+
public class IntegerPropertyNestingBuilder extends AbstractNestingBuilderOnProperty<Number, IntegerProperty> {
1212

1313
// #region CONSTRUCTION
1414

@@ -23,7 +23,7 @@ public class IntegerPropertyNestingBuilder extends AbstractNestingBuilder<Number
2323
* the function which performs the nesting step from one observable to the next
2424
*/
2525
<P> IntegerPropertyNestingBuilder(
26-
AbstractNestingBuilder<P, ?> previousNestedBuilder,
26+
AbstractNestingBuilderOnObservableValue<P, ?> previousNestedBuilder,
2727
NestingStep<P, IntegerProperty> nestingStep) {
2828

2929
super(previousNestedBuilder, nestingStep);

0 commit comments

Comments
 (0)