Class POptional<S,T,A,B>
java.lang.Object
fj.data.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 \/ Aset : (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 monomoprhic 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(F<A, Either<L, B>> f) modify polymorphically the target of aPOptionalwith an Applicative functionmodifyFunctionF(F<A, F<C, B>> f) modify polymorphically the target of aPOptionalwith an Applicative functionmodify polymorphically the target of aPOptionalwith an Applicative functionmodifyListF(F<A, List<B>> f) modify polymorphically the target of aPOptionalwith an Applicative functionmodifyOption(F<A, B> f) modify polymorphically the target of aPOptionalwith a function.modifyOptionF(F<A, Option<B>> f) modify polymorphically the target of aPOptionalwith an Applicative functionmodify polymorphically the target of aPOptionalwith an Applicative functionmodifyPromiseF(F<A, Promise<B>> f) modify polymorphically the target of aPOptionalwith an Applicative functionmodifyStreamF(F<A, Stream<B>> f) modify polymorphically the target of aPOptionalwith an Applicative functionabstract F<S, Trampoline<T>> modifyTrampolineF(F<A, Trampoline<B>> f) modify polymorphically the target of aPOptionalwith an Applicative functionmodify polymorphically the target of aPOptionalwith an Applicative functionabstract <E> F<S, Validation<E, T>> modifyValidationF(F<A, Validation<E, 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
-
modifyIOF
-
modifyTrampolineF
modify polymorphically the target of aPOptionalwith an Applicative function -
modifyPromiseF
-
modifyListF
-
modifyOptionF
-
modifyStreamF
-
modifyP1F
-
modifyValidationF
modify polymorphically the target of aPOptionalwith an Applicative function -
modifyV2F
-
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
-