Spring Data MongoDB - Core

org.springframework.data.mongodb.core.aggregation
Class AggregationResults<T>

java.lang.Object
  extended by org.springframework.data.mongodb.core.aggregation.AggregationResults<T>
Type Parameters:
T - The class in which the results are mapped onto.
All Implemented Interfaces:
Iterable<T>

public class AggregationResults<T>
extends Object
implements Iterable<T>

Collects the results of executing an aggregation operation.

Since:
1.3
Author:
Tobias Trelle, Oliver Gierke

Constructor Summary
AggregationResults(List<T> mappedResults, com.mongodb.DBObject rawResults)
          Creates a new AggregationResults instance from the given mapped and raw results.
 
Method Summary
 List<T> getMappedResults()
          Returns the aggregation results.
 String getServerUsed()
          Returns the server that has been used to perform the aggregation.
 T getUniqueMappedResult()
          Returns the unique mapped result.
 Iterator<T> iterator()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AggregationResults

public AggregationResults(List<T> mappedResults,
                          com.mongodb.DBObject rawResults)
Creates a new AggregationResults instance from the given mapped and raw results.

Parameters:
mappedResults - must not be null.
rawResults - must not be null.
Method Detail

getMappedResults

public List<T> getMappedResults()
Returns the aggregation results.

Returns:

getUniqueMappedResult

public T getUniqueMappedResult()
Returns the unique mapped result. Assumes no result or exactly one.

Returns:
Throws:
IllegalArgumentException - in case more than one result is available.

iterator

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

getServerUsed

public String getServerUsed()
Returns the server that has been used to perform the aggregation.

Returns:

Spring Data MongoDB - Core

Copyright © 2011-2013-2013 Pivotal. All Rights Reserved.