Class POptional<S,T,A,B>
java.lang.Object
io.atlassian.fugue.optic.POptional<S,T,A,B>
- Type Parameters:
S- the source of aPOptionalT- the modified source of aPOptionalA- the target of aPOptionalB- the modified target of aPOptional
- Direct Known Subclasses:
Optional
A
POptional can be seen as a pair of functions: - `getOrModify: S
=> T \/ A` - `set : (B, S) => T`
A POptional could also be defined as a weaker PLens and
weaker PPrism
POptional stands for Polymorphic Optional as it set and modify
methods change a type `A` to `B` and `S` to `T`. Optional is a
POptional restricted to monomorphic updates: {{{ type Optional[S, A]
= POptional[S, S, A, A] }}}
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionasFold()asSetter()PTraversal<S, T, A, B> view aPOptionalas aPTraversalcomposeFold(Fold<A, C> other) composeGetter(Getter<A, C> other) composeIso(PIso<A, B, C, D> other) composeLens(PLens<A, B, C, D> other) composeOptional(POptional<A, B, C, D> other) composePrism(PPrism<A, B, C, D> other) composeSetter(PSetter<A, B, C, D> other) final <C,D> PTraversal <S, T, C, D> composeTraversal(PTraversal<A, B, C, D> other) compose aPOptionalwith aPTraversalfirst()get the target of aPOptionalor nothing if there is no targetgetOrModify(S s) get the target of aPOptionalor modify the source in case there is no targetfinal booleanisMatching(S s) check if aPOptionalhas a targetmodify polymorphically the target of aPOptionalwith a functionmodifyEitherF(Function<A, Either<L, B>> f) modify polymorphically the target of aPOptionalwith an Applicative functionmodifyFunctionF(Function<A, Function<C, B>> f) modify polymorphically the target of aPOptionalwith an Applicative functionmodifyIterableF(Function<A, Iterable<B>> f) modify polymorphically the target of aPOptionalwith an Applicative functionmodifyOption(Function<A, B> f) modify polymorphically the target of aPOptionalwith a function.modifyOptionF(Function<A, Option<B>> f) modify polymorphically the target of aPOptionalwith an Applicative functionmodify polymorphically the target of aPOptionalwith an Applicative functionmodifySupplierF(Function<A, Supplier<B>> f) modify polymorphically the target of aPOptionalwith an Applicative functionstatic <S,T> POptional <S, T, S, T> pId()static <S,T, A, B> POptional <S, T, A, B> create aPOptionalusing the canonical functions: getOrModify and setsecond()get the modified source of aPOptionalset polymorphically the target of aPOptionalwith a value.join twoPOptionalwith the same target
-
Constructor Details
-
POptional
POptional()
-
-
Method Details
-
getOrModify
-
set
-
getOption
-
modifyFunctionF
-
modifyEitherF
-
modifyOptionF
-
modifyPairF
-
modifySupplierF
-
modifyIterableF
-
modify
-
modifyOption
-
setOption
-
isMatching
-
sum
-
first
-
second
-
composeFold
-
composeGetter
-
composeSetter
-
composeTraversal
compose aPOptionalwith aPTraversal -
composeOptional
-
composePrism
-
composeLens
-
composeIso
-
asFold
-
asSetter
-
asTraversal
view aPOptionalas aPTraversal -
pId
-
pOptional
-