Advertisement
Guest User

Untitled

a guest
Apr 9th, 2020
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1. @Builder
  2. @RequiredArgsConstructor(access = AccessLevel.PRIVATE)
  3. public final class Repo {
  4.   private final Function<String, RevCommit> commitStrategy;
  5.  
  6.   public Option<RevCommit> commit(String commitMessage) {
  7.     return Option(commitStrategy)
  8.       .onEmpty(() -> log.info("no CommitStrategy defined"))
  9.       .map($ -> $.apply(commitMessage));
  10.   }
  11.  
  12.   public static Repo Repo(){
  13.     return Repo.builder()
  14.       .commitStrategy(SOME_STATIC_FUNCTION) // or provided via factory args
  15.       .build();
  16.   }
  17.  
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement