com.atlassian.greenhopper.service
Interface ServiceOutcome<T>

All Superinterfaces:
com.atlassian.fugue.Effect.Applicant<T>
All Known Implementing Classes:
ServiceOutcomeImpl

public interface ServiceOutcome<T>
extends com.atlassian.fugue.Effect.Applicant<T>

A service result that has an value.


Method Summary
<A> ServiceOutcome<A>
error()
           
<A> ServiceOutcome<A>
flatMap(com.google.common.base.Function<? super T,ServiceOutcome<A>> func)
           
 ErrorCollection getErrors()
           
 T getValue()
          Returns the value that was returned by the service, or null.
 boolean isInvalid()
           
 boolean isValid()
           
<A> ServiceOutcome<A>
map(com.google.common.base.Function<? super T,A> func)
           
 com.atlassian.fugue.Either<ErrorCollection,com.atlassian.fugue.Option<T>> toEither()
           
 com.atlassian.fugue.Option<T> toOption()
           
 
Methods inherited from interface com.atlassian.fugue.Effect.Applicant
foreach
 

Method Detail

isValid

boolean isValid()
Returns:
true if there are no errors, false otherwise.

isInvalid

boolean isInvalid()
Returns:
true if there are errors, false otherwise.

getErrors

@NotNull
ErrorCollection getErrors()
Returns:
an ErrorCollection that contains any errors that may have happened as a result of the validations.

getValue

@Nullable
T getValue()
Returns the value that was returned by the service, or null.

Returns:
the value returned by the service, or null

toOption

com.atlassian.fugue.Option<T> toOption()

toEither

com.atlassian.fugue.Either<ErrorCollection,com.atlassian.fugue.Option<T>> toEither()

map

@NotNull
<A> ServiceOutcome<A> map(com.google.common.base.Function<? super T,A> func)
Type Parameters:
A - the type of the ServiceOutcome
Parameters:
func - a function which takes a instance of type T and returns an instance of type A
Returns:
a new service outcome based on the output of func

flatMap

@NotNull
<A> ServiceOutcome<A> flatMap(com.google.common.base.Function<? super T,ServiceOutcome<A>> func)
Type Parameters:
A - the type of the ServiceOutcome
Parameters:
func - a function which takes a instance of type T and returns a ServiceOutcome of type A
Returns:
a new service outcome based on the output of func

error

<A> ServiceOutcome<A> error()


Copyright © 2007-2013 Atlassian. All Rights Reserved.