Package io.vavr.control
Class Validation.Builder<E,T1,T2>
- java.lang.Object
-
- io.vavr.control.Validation.Builder<E,T1,T2>
-
- Type Parameters:
E- type of errorT1- type of first valid valueT2- type of second valid value
- Enclosing interface:
- Validation<E,T>
public static final class Validation.Builder<E,T1,T2> extends java.lang.ObjectA builder that holds two Validation instances, used for combining validations and applying functions that take two arguments.
-
-
Field Summary
Fields Modifier and Type Field Description private Validation<E,T1>v1private Validation<E,T2>v2
-
Constructor Summary
Constructors Modifier Constructor Description privateBuilder(Validation<E,T1> v1, Validation<E,T2> v2)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <R> Validation<Seq<E>,R>ap(Function2<T1,T2,R> f)Applies a binary function to the values of the two validations held by this builder.<T3> Validation.Builder3<E,T1,T2,T3>combine(Validation<E,T3> v3)Combines this builder with another validation, creating a Builder3.
-
-
-
Field Detail
-
v1
private Validation<E,T1> v1
-
v2
private Validation<E,T2> v2
-
-
Constructor Detail
-
Builder
private Builder(Validation<E,T1> v1, Validation<E,T2> v2)
-
-
Method Detail
-
ap
public <R> Validation<Seq<E>,R> ap(Function2<T1,T2,R> f)
Applies a binary function to the values of the two validations held by this builder. If all validations are valid, the function is applied. Otherwise, errors are accumulated.- Type Parameters:
R- type of the result- Parameters:
f- the function to apply- Returns:
- a Validation with the result or accumulated errors
-
combine
public <T3> Validation.Builder3<E,T1,T2,T3> combine(Validation<E,T3> v3)
Combines this builder with another validation, creating a Builder3.- Type Parameters:
T3- type of third valid value- Parameters:
v3- the third validation- Returns:
- a new Builder3 instance
-
-