net.customware.gwt.dispatch.shared
Class BatchResult

java.lang.Object
  extended by net.customware.gwt.dispatch.shared.BatchResult
All Implemented Interfaces:
com.google.gwt.user.client.rpc.IsSerializable, Iterable<Result>, Result

public class BatchResult
extends Object
implements Result, Iterable<Result>

Contains the list of Results from successful actions in the BatchAction. The order will match the order of the original Actions listed in the BatchAction.

If the BatchAction was specified to have an BatchAction.OnException value of BatchAction.OnException.CONTINUE, failed actions will have a null value, and there will be an exception available via the getExceptions() or getException(int) methods for the same index.

This class also implements Iterable, so it can be used in 'for' loops.

Author:
David Peterson

Constructor Summary
BatchResult(List<Result> results, List<DispatchException> exceptions)
          Creates a new result with the list of results from the batch action, in order.
 
Method Summary
 Throwable getException(int index)
           
 List<DispatchException> getExceptions()
          The list of exceptions, matched to the result number.
 Result getResult(int i)
          Returns the result for the specified index.
<T extends Result>
T
getResult(int i, Class<T> type)
          Returns the result only if the value at the specified index is of the specified type.
 List<Result> getResults()
          The list of results.
 Iterator<Result> iterator()
           
 int size()
          The size of the result set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BatchResult

public BatchResult(List<Result> results,
                   List<DispatchException> exceptions)
Creates a new result with the list of results from the batch action, in order.

Parameters:
results - The list of results.
Method Detail

getResults

public List<Result> getResults()
The list of results.

Returns:

getExceptions

public List<DispatchException> getExceptions()
The list of exceptions, matched to the result number.

Returns:

size

public int size()
The size of the result set.

Returns:

getResult

public Result getResult(int i)
Returns the result for the specified index.

Parameters:
i - The index.
Returns:
The result.

getResult

public <T extends Result> T getResult(int i,
                                      Class<T> type)
Returns the result only if the value at the specified index is of the specified type. It does not support the specified class being a superclass of the result type.

Type Parameters:
T - The type of result to retrieve.
Parameters:
i - The index.
type - The type value.
Returns:
The result, if it matches.

getException

public Throwable getException(int index)

iterator

public Iterator<Result> iterator()
Specified by:
iterator in interface Iterable<Result>


Copyright © 2011 customware.net. All Rights Reserved.