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 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 Function<S,Optional<T>>
get
get the target of an Optional or nothing if there is no targetFunction<Function<T,T>,Function<S,S>>
modify
modify the target of an optional with a function if it exists, returing the same source otherwiseFunction<T,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
-