Skip to content

Commit 8d38e29

Browse files
author
nicolaiparlog
committed
Renamed methods to create 'NestingObserver'.
1 parent 82fb72c commit 8d38e29

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
* present.
2323
* <p>
2424
* The observer is created with a {@link NestingObserverBuilder} which can be obtained from
25-
* {@link NestingObserver#observe(Nesting) observe}. After setting some of the methods mentioned above, the observer is
26-
* built by calling {@link NestingObserverBuilder#build()}.
25+
* {@link NestingObserver#forNesting(Nesting) observe}. After setting some of the methods mentioned above, the observer
26+
* is built by calling {@link NestingObserverBuilder#observe()}.
2727
*
2828
* @param <O>
2929
* the type of the nesting hierarchy's innermost {@link Observable}
@@ -83,7 +83,7 @@ private NestingObserver(NestingObserverBuilder<O> builder) {
8383
* the observed {@link Nesting}
8484
* @return a new {@link NestingObserverBuilder}
8585
*/
86-
public static <O extends Observable> NestingObserverBuilder<O> observe(Nesting<O> nesting) {
86+
public static <O extends Observable> NestingObserverBuilder<O> forNesting(Nesting<O> nesting) {
8787
return new NestingObserverBuilder<O>(nesting);
8888
}
8989

@@ -211,11 +211,10 @@ public NestingObserverBuilder<O> whenInnerObservableChanges(BiConsumer<Boolean,
211211

212212
/**
213213
* Builds a observer from this builder's settings.
214-
*
215-
* @return a new {@link NestingObserver}
216214
*/
217-
public NestingObserver<O> build() {
218-
return new NestingObserver<O>(this);
215+
@SuppressWarnings("unused")
216+
public void observe() {
217+
new NestingObserver<O>(this);
219218
}
220219

221220
}

src/org/codefx/libfx/nesting/property/PropertyToNestingBinding.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ public static <T> void bind(
4646
// the 'innerObservablePresentSetter' only accepts one Boolean; create a 'BiConsumer' from it,
4747
// which accepts two and ignores the first
4848
BiConsumer<Boolean, Boolean> innerObservablePresentBiSetter =
49-
(oldPropertyPresent, newPropertyPresent) -> innerObservablePresentSetter.accept(newPropertyPresent);
49+
(any, newPropertyPresent) -> innerObservablePresentSetter.accept(newPropertyPresent);
5050

51-
// use a nesting observer to accomplish the binding/unbinding
51+
// use a nesting observer to accomplish the binding/unbinding
5252
NestingObserver
53-
.observe(nesting)
53+
.forNesting(nesting)
5454
.withOldInnerObservable(oldProperty -> nestedProperty.unbindBidirectional(oldProperty))
5555
.withNewInnerObservable(newProperty -> nestedProperty.bindBidirectional(newProperty))
5656
.whenInnerObservableChanges(innerObservablePresentBiSetter)
57-
.build();
57+
.observe();
5858
}
5959

6060
}

test/org/codefx/libfx/nesting/NestingObserverTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ public void setUpObservation(INNER_OBSERVABLE_INITIALLY_PRESENT initiallyPresent
6262

6363
// create a nesting observer for the nesting which calls the verifier's methods
6464
NestingObserver
65-
.observe(nesting)
65+
.forNesting(nesting)
6666
.withOldInnerObservable(verifier::oldInnerObservableMethod)
6767
.withNewInnerObservable(verifier::newInnerObservableMethod)
6868
.whenInnerObservableChanges(verifier::innerObservableChangesMethod)
69-
.build();
69+
.observe();
7070

7171
// creating the observer already called some methods; reset the mock to not confuse the counts
7272
if (resetMock.toBoolean())

0 commit comments

Comments
 (0)