Package jsonvalues
Class Option<S,T>
- java.lang.Object
-
- jsonvalues.Option<S,T>
-
- Type Parameters:
S
- the source of an optionalT
- the target of an optional
public class Option<S,T> extends java.lang.Object
An Optional is an optic that allows seeing into a structure and getting, setting, or modifying an optional focus. It combines the properties of a Lens (getting, setting, and modifying) with the properties of a Prism (an optional focus). An Optional can be seen as a pair of functions:- get: S => Optional[T] - set: (T, S) => S
A Optional could also be defined as a weaker Lens and weaker Prism
-
-
Field Summary
Fields Modifier and Type Field Description java.util.function.Function<S,java.util.Optional<T>>
get
get the target of an Optional or nothing if there is no targetjava.util.function.Function<java.util.function.Function<T,T>,java.util.function.Function<S,S>>
modify
modify the target of an optional with a function if it exists, returing the same source otherwisejava.util.function.Function<T,java.util.function.Function<S,S>>
set
function to look into S, set a value for an optional focus T, and obtain the modified source
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <F> Option<S,F>
compose(Option<T,F> other)
compose this optional with the given as parameter
-
-
-
Field Detail
-
get
public final java.util.function.Function<S,java.util.Optional<T>> get
get the target of an Optional or nothing if there is no target
-
set
public final java.util.function.Function<T,java.util.function.Function<S,S>> set
function to look into S, set a value for an optional focus T, and obtain the modified source
-
-