@Test public void prismTest() { Option<String> some = Option.some("a"); Option<String> none = Option.none(); assertAll( () -> assertEquals(some, someString.getOption(some)), () -> assertEquals(none, someString.getOption(none)), () -> assertEquals(some, someString.reverseGet("a")), () -> assertEquals(Option.some("A"), someString.modify(String::toUpperCase).apply(some)), () -> assertEquals(none, someString.modify(String::toUpperCase).apply(none)), () -> assertEquals(Option.some("A"), someString.modifyOption(String::toUpperCase).apply(some).flatMap(identity())), () -> assertEquals(none, someString.modifyOption(String::toUpperCase).apply(none)), () -> assertEquals(Option.some("A"), someString.set("A").apply(some)), () -> assertEquals(none, someString.set("A").apply(none)), () -> assertEquals(Option.some("A"), someString.setOption("A").apply(some).flatMap(identity())), () -> assertEquals(none, someString.setOption("A").apply(none)), () -> assertEquals(Either.right("a"), someString.getOrModify(some)), () -> assertEquals(Either.left(none), someString.getOrModify(none)) ); }
protected Prism(PPrism<S, S, A, A> delegate) { this.delegate = checkNonNull(delegate); }
Prism { protected Prism(PPrism<S, S, A, A> delegate) { this.delegate = checkNonNull(delegate); } }
Prism { protected Prism(PPrism<S, S, A, A> delegate) { this.delegate = checkNonNull(delegate); } protected  Prism(PPrism<S, S, A, A> delegate); }
Prism { protected Prism(PPrism<S, S, A, A> delegate) { this.delegate = checkNonNull(delegate); } protected  Prism(PPrism<S, S, A, A> delegate); static Prism<S, A> of(Function1<S, Option<A>> getOption, Function1<A, S> reverseGet); Option<A> getOption(S target); S reverseGet(A value); Either<S, A> getOrModify(S target); Operator1<S> modify(Operator1<A> mapper); S modify(S target, Operator1<A> mapper); Operator1<S> set(A value); S set(S target, A value); Function1<S, Option<S>> modifyOption(Operator1<A> mapper); Function1<S, Option<S>> setOption(A value); Optional<S, A> asOptional(); Prism<S, B> compose(Prism<A, B> other); Optional<S, B> compose(Optional<A, B> other); Prism<S, B> compose(Iso<A, B> other); Optional<S, B> compose(Lens<A, B> other); }
Prism { protected Prism(PPrism<S, S, A, A> delegate) { this.delegate = checkNonNull(delegate); } protected  Prism(PPrism<S, S, A, A> delegate); static Prism<S, A> of(Function1<S, Option<A>> getOption, Function1<A, S> reverseGet); Option<A> getOption(S target); S reverseGet(A value); Either<S, A> getOrModify(S target); Operator1<S> modify(Operator1<A> mapper); S modify(S target, Operator1<A> mapper); Operator1<S> set(A value); S set(S target, A value); Function1<S, Option<S>> modifyOption(Operator1<A> mapper); Function1<S, Option<S>> setOption(A value); Optional<S, A> asOptional(); Prism<S, B> compose(Prism<A, B> other); Optional<S, B> compose(Optional<A, B> other); Prism<S, B> compose(Iso<A, B> other); Optional<S, B> compose(Lens<A, B> other);  }