com.amazonaws.services.dynamodb.datamodeling
Class PaginatedList<T>

java.lang.Object
  extended by com.amazonaws.services.dynamodb.datamodeling.PaginatedList<T>
Type Parameters:
T - The domain object type stored in this list.
All Implemented Interfaces:
Iterable<T>, Collection<T>, List<T>
Direct Known Subclasses:
PaginatedQueryList, PaginatedScanList

public abstract class PaginatedList<T>
extends Object
implements List<T>

Unmodifiable list supporting paginated result sets from Amazon DynamoDB.

Pages of results are fetched lazily from DynamoDB as they are needed. Some methods, such as size() and toArray(), require fetching the entire result set eagerly. See the javadoc of individual methods for details on which are lazy.


Constructor Summary
PaginatedList(DynamoDBMapper mapper, Class<T> clazz, AmazonDynamoDB dynamo)
           
 
Method Summary
 void add(int arg0, T arg1)
           
 boolean add(T arg0)
           
 boolean addAll(Collection<? extends T> arg0)
           
 boolean addAll(int arg0, Collection<? extends T> arg1)
           
 void clear()
           
 boolean contains(Object arg0)
          Returns whether the collection contains the given element.
 boolean containsAll(Collection<?> arg0)
           
 T get(int n)
          Returns the Nth element of the list.
 int indexOf(Object arg0)
          Returns the first index of the object given in the list.
 boolean isEmpty()
          Returns whether the collection is empty.
 Iterator<T> iterator()
          Returns an iterator over this list that lazily initializes results as necessary.
 int lastIndexOf(Object arg0)
           
 ListIterator<T> listIterator()
           
 ListIterator<T> listIterator(int arg0)
           
 void loadAllResults()
          Eagerly loads all results for this list.
 T remove(int arg0)
           
 boolean remove(Object arg0)
           
 boolean removeAll(Collection<?> arg0)
           
 boolean retainAll(Collection<?> arg0)
           
 T set(int arg0, T arg1)
           
 int size()
           
 List<T> subList(int arg0, int arg1)
          Returns a sub-list in the range specified, loading more results as necessary.
 Object[] toArray()
           
<X> X[]
toArray(X[] a)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.List
equals, hashCode
 

Constructor Detail

PaginatedList

public PaginatedList(DynamoDBMapper mapper,
                     Class<T> clazz,
                     AmazonDynamoDB dynamo)
Method Detail

loadAllResults

public void loadAllResults()
Eagerly loads all results for this list.


iterator

public Iterator<T> iterator()
Returns an iterator over this list that lazily initializes results as necessary.

Specified by:
iterator in interface Iterable<T>
Specified by:
iterator in interface Collection<T>
Specified by:
iterator in interface List<T>

isEmpty

public boolean isEmpty()
Returns whether the collection is empty. At most one (non-empty) page of results is loaded to make the check.

Specified by:
isEmpty in interface Collection<T>
Specified by:
isEmpty in interface List<T>

get

public T get(int n)
Returns the Nth element of the list. Results are loaded until N elements are present, if necessary.

Specified by:
get in interface List<T>

contains

public boolean contains(Object arg0)
Returns whether the collection contains the given element. Results are loaded and checked incrementally until a match is found or the end of the result set is reached.

Specified by:
contains in interface Collection<T>
Specified by:
contains in interface List<T>

subList

public List<T> subList(int arg0,
                       int arg1)
Returns a sub-list in the range specified, loading more results as necessary.

Specified by:
subList in interface List<T>

indexOf

public int indexOf(Object arg0)
Returns the first index of the object given in the list. Additional results are loaded incrementally as necessary.

Specified by:
indexOf in interface List<T>

size

public int size()
Specified by:
size in interface Collection<T>
Specified by:
size in interface List<T>

containsAll

public boolean containsAll(Collection<?> arg0)
Specified by:
containsAll in interface Collection<T>
Specified by:
containsAll in interface List<T>

lastIndexOf

public int lastIndexOf(Object arg0)
Specified by:
lastIndexOf in interface List<T>

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection<T>
Specified by:
toArray in interface List<T>

toArray

public <X> X[] toArray(X[] a)
Specified by:
toArray in interface Collection<T>
Specified by:
toArray in interface List<T>

listIterator

public ListIterator<T> listIterator()
Specified by:
listIterator in interface List<T>

listIterator

public ListIterator<T> listIterator(int arg0)
Specified by:
listIterator in interface List<T>

remove

public boolean remove(Object arg0)
Specified by:
remove in interface Collection<T>
Specified by:
remove in interface List<T>

remove

public T remove(int arg0)
Specified by:
remove in interface List<T>

removeAll

public boolean removeAll(Collection<?> arg0)
Specified by:
removeAll in interface Collection<T>
Specified by:
removeAll in interface List<T>

retainAll

public boolean retainAll(Collection<?> arg0)
Specified by:
retainAll in interface Collection<T>
Specified by:
retainAll in interface List<T>

set

public T set(int arg0,
             T arg1)
Specified by:
set in interface List<T>

add

public boolean add(T arg0)
Specified by:
add in interface Collection<T>
Specified by:
add in interface List<T>

add

public void add(int arg0,
                T arg1)
Specified by:
add in interface List<T>

addAll

public boolean addAll(Collection<? extends T> arg0)
Specified by:
addAll in interface Collection<T>
Specified by:
addAll in interface List<T>

addAll

public boolean addAll(int arg0,
                      Collection<? extends T> arg1)
Specified by:
addAll in interface List<T>

clear

public void clear()
Specified by:
clear in interface Collection<T>
Specified by:
clear in interface List<T>


Copyright © 2010 Amazon Web Services, Inc. All Rights Reserved.