|
Copyright 2008 - 2009 Tony Morris, Runar Bjarnason, Tom Adams, Brad Clow, Ricky Clarkson, Nick Partridge, Jason Zaugg This software is released under an open source BSD licence. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfj.data.Validation.FailProjection<E,T>
public final class Validation.FailProjection<E,T>
A failing projection of a validation.
Method Summary | ||
---|---|---|
|
apply(Validation<F<E,A>,T> v)
Function application on the failing value. |
|
|
bind(F<E,Validation<A,T>> f)
Binds the given function across this validation's failing value if it has one. |
|
boolean |
exists(F<E,Boolean> f)
Returns false if this is a success or returns the result of the application of the given
function to the failing value. |
|
E |
failE(P1<String> err)
Returns the failing value or fails with the given error message. |
|
E |
failE(String err)
Returns the failing value or fails with the given error message. |
|
|
filter(F<E,Boolean> f)
Returns None if this is a success or if the given predicate p does not hold for the
failing value, otherwise, returns a fail in Some . |
|
boolean |
forall(F<E,Boolean> f)
Returns true if this is a success or returns the result of the application of the given
function to the failing value. |
|
void |
foreach(Effect<E> f)
Executes a side-effect on the failing value if there is one. |
|
Unit |
foreach(F<E,Unit> f)
Executes a side-effect on the failing value if there is one. |
|
Iterator<E> |
iterator()
Returns an iterator for this projection. |
|
|
map(F<E,A> f)
Maps the given function across the failing side of this validation. |
|
E |
on(F<T,E> f)
The failing value or the application of the given function to the success value. |
|
E |
orFail(E e)
Returns the failing value or the given value. |
|
E |
orFail(P1<E> e)
Returns the failing value or the given value. |
|
|
sequence(Validation<A,T> v)
Performs a bind across the validation, but ignores the element value in the function. |
|
Array<E> |
toArray()
Returns a single element array if this is a failing value, otherwise an empty list. |
|
List<E> |
toList()
Returns a single element list if this is a failing value, otherwise an empty list. |
|
Option<E> |
toOption()
Returns the failing value in Some if there is one, otherwise None . |
|
Stream<E> |
toStream()
Returns a single element stream if this is a failing value, otherwise an empty list. |
|
Validation<E,T> |
validation()
Returns the underlying validation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public Validation<E,T> validation()
public E failE(P1<String> err)
err
- The error message to fail with.
public E failE(String err)
err
- The error message to fail with.
public E orFail(P1<E> e)
e
- The value to return if this is success.
public E orFail(E e)
e
- The value to return if this is success.
public E on(F<T,E> f)
f
- The function to execute on the success value.
public Unit foreach(F<E,Unit> f)
f
- The side-effect to execute.
public void foreach(Effect<E> f)
f
- The side-effect to execute.public <A> Validation<A,T> map(F<E,A> f)
f
- The function to map.
public <A> Validation<A,T> bind(F<E,Validation<A,T>> f)
f
- The function to bind across this validation.
public <A> Validation<A,T> sequence(Validation<A,T> v)
v
- The validation value to apply in the final join.
public <A> Option<Validation<E,A>> filter(F<E,Boolean> f)
None
if this is a success or if the given predicate p
does not hold for the
failing value, otherwise, returns a fail in Some
.
f
- The predicate function to test on this failing value.
None
if this is a success or if the given predicate p
does not hold for the
failing value, otherwise, returns a fail in Some
.public <A> Validation<A,T> apply(Validation<F<E,A>,T> v)
v
- The validation of the function to apply on the failing value.
public boolean forall(F<E,Boolean> f)
true
if this is a success or returns the result of the application of the given
function to the failing value.
f
- The predicate function to test on this failing value.
true
if this is a success or returns the result of the application of the given
function to the failing value.public boolean exists(F<E,Boolean> f)
false
if this is a success or returns the result of the application of the given
function to the failing value.
f
- The predicate function to test on this failing value.
false
if this is a success or returns the result of the application of the given
function to the failing value.public List<E> toList()
public Option<E> toOption()
Some
if there is one, otherwise None
.
Some
if there is one, otherwise None
.public Array<E> toArray()
public Stream<E> toStream()
public Iterator<E> iterator()
for
-each loop.
iterator
in interface Iterable<E>
|
Copyright 2008 - 2009 Tony Morris, Runar Bjarnason, Tom Adams, Brad Clow, Ricky Clarkson, Nick Partridge, Jason Zaugg This software is released under an open source BSD licence. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |