Created
December 9, 2015 22:31
-
-
Save gszeliga/ce7c95f4aa7f98e4bce4 to your computer and use it in GitHub Desktop.
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
public static class CompositionSources<B> | |
{ | |
private CompositionSources(){ } | |
public interface Partial<B> | |
{ | |
CompletableFuture<Outcome<B>> apply(CompletableFuture<Outcome<B>> b); | |
} | |
public interface MergingStage<B, V>{ | |
Partial<B> by(BiFunction<Outcome<B>, Outcome<V>, Outcome<B>> f); | |
} | |
public <V> MergingStage<B, V> value(CompletableFuture<Outcome<V>> value){ | |
return f -> builder | |
-> builder.thenCombine(value, (b, v) -> f.apply(b, v) | |
.dependingOn(b) | |
.dependingOn(v)); | |
} | |
public static <B> CompositionSources<B> stickedTo(Class<B> clazz) | |
{ | |
return new CompositionSources<>(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment