Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring. Create MetaBinding class
- Loading branch information
Showing
4 changed files
with
68 additions
and
46 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
gs-reactor/src/main/java/org/genericsystem/reactor/MetaBinding.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.genericsystem.reactor; | ||
|
||
import java.util.function.BiFunction; | ||
import java.util.function.Function; | ||
|
||
import javafx.collections.ObservableList; | ||
|
||
public class MetaBinding<BETWEEN> { | ||
private final Function<Model, ObservableList<BETWEEN>> betweenChildren; | ||
private final BiFunction<Model, BETWEEN, Model> modelBuilder; | ||
|
||
public MetaBinding(Function<Model, ObservableList<BETWEEN>> betweenChildren, BiFunction<Model, BETWEEN, Model> modelBuilder) { | ||
this.betweenChildren = betweenChildren; | ||
this.modelBuilder = modelBuilder; | ||
} | ||
|
||
public ObservableList<BETWEEN> buildBetweenChildren(Model model) { | ||
return betweenChildren.apply(model); | ||
} | ||
|
||
public Model buildModel(Model parent, BETWEEN betweenChild) { | ||
return modelBuilder.apply(parent, betweenChild); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters