Invalid<E, A> class
final
A Validated that represents a failure, or invalid value.
- Inheritance
- Available extensions
Constructors
- Invalid(E value)
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isInvalid → bool
-
Returns true if this instance is an Invalid, otherwise false is returned.
no setterinherited
- isValid → bool
-
Returns true if this instance is a Valid, otherwise false is returned.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value → E
-
final
Methods
-
andThen<
B> (Function1< A, Validated< f) → Validated<E, B> >E, B> -
Creates a new Validated by applying
fif this is a Valid, otherwise returns the error value.inherited -
ap<
B> (ValidatedNel< E, Function1< f) → ValidatedNel<A, B> >E, B> -
Available on ValidatedNel<
AppliesE, A> , provided by the ValidatedNelOps extensionfto this value if both instance are Valid. Otherwise returns the error if either is Invalid or the accumulation of errors if both are Invalid. -
bimap<
EE, AA> (Function1< E, EE> fe, Function1<A, AA> fa) → Validated<EE, AA> -
Returns a new Validated by applying
feorfadepending on if this instance is an Invalid or Valid respectively.inherited -
ensure(
Function1< A, bool> p, Function0<E> onFailure) → Validated<E, A> -
Tests if the valid value (if any) passes the given predicate
p. If it fails, a new Invalid with a value ofonFailureis returned, otherwise this instance is returned.inherited -
ensureOr(
Function1< A, bool> p, Function1<A, E> onFailure) → Validated<E, A> -
Tests if the valid value (if any) passes the given predicate
p. If it fails, a new Invalid with a value ofonFailureis returned, otherwise this instance is returned.inherited -
exists(
Function1< A, bool> p) → bool -
Returns true if this instance has a valid value to pass the given
predicate
p.inherited -
flatten(
) → Validated< E, A> -
Available on Validated<
Extracts the nested Validated via fold.E, Validated< , provided by the ValidatedNestedOps extensionE, A> > -
fold<
B> (Function1< E, B> fe, Function1<A, B> fa) → B -
Returns the result of applying
feif this is an instance of Invalid, otherwise the result of applyingfato this Valid.override -
forall(
Function1< A, bool> p) → bool -
Returns true if this instance has a valid value to pass the given
predicate
p.inherited -
foreach(
Function1< A, void> f) → void -
Applies the given side-effect
ffor every valid value this instance represents.inherited -
getOrElse(
Function0< A> orElse) → A -
Returns the value of this instance if it is a Valid, otherwise returns
the result of evaluating
orElse.inherited -
leftMap<
EE> (Function1< E, EE> f) → Validated<EE, A> -
Returns a new validated by applying
fto the value of this instance if it is an Invalid.inherited -
map<
B> (Function1< A, B> f) → Validated<E, B> -
Returns a new validated by applying
fto the value of this instance if it is a Valid.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
orElse(
Function0< Validated< orElse) → Validated<E, A> >E, A> -
If this instance is a Valid, this is returned. Otherwise, the result of
evaluating
orElseis returned.inherited -
product<
B> (ValidatedNel< E, B> that) → ValidatedNel<E, (A, B)> -
Available on ValidatedNel<
Returns the product (tuple) of this validation andE, A> , provided by the ValidatedNelOps extensionthatif both instances are Valid. Otherwise returns the error if either is Invalid or the accumulation of errors if both are Invalid. -
swap(
) → Validated< A, E> -
Returns a new Validated where the invalid and valid types are swapped.
inherited
-
toEither(
) → Either< E, A> -
Returns a new Either where the left and right types correspond to the
invalid and valid types respectively.
inherited
-
toIList(
) → IList< A> -
Returns a new IList with the valid value of this instance, if any.
If this instance is Invalid, an empty IList is returned.
inherited
-
toOption(
) → Option< A> -
Returns None if this instance is an Invalid, otherwise a Some with
the valid value.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
toValidatedNel(
) → ValidatedNel< E, A> -
Converts this instance to a ValidatedNel.
inherited
-
valueOr(
Function1< E, A> f) → A -
Alias for fold.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited