Class KeyRange
- java.lang.Object
-
- com.google.appengine.api.datastore.KeyRange
-
- All Implemented Interfaces:
Serializable
,Iterable<Key>
public final class KeyRange extends Object implements Iterable<Key>, Serializable
Represents a range of unique datastore identifiers fromgetStart().getId()
togetEnd().getId()
inclusive. If an instance of this class is the result of a call toDatastoreService.allocateIds()
, theKeys
returned by this instance have been consumed in the datastore's id-space and are guaranteed never to be reused.
This class can be used to constructEntities
withKeys
that have specific id values without fear of the datastore creating new records with those same ids at a later date. This can be helpful as part of a data migration or large bulk upload where you may need to preserve existing ids and relationships between entities.
This class is threadsafe but theIterators
returned byiterator()
are not.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(@Nullable Object obj)
Key
getEnd()
Returns the lastKey
in the range.long
getSize()
Returns the size of the range.Key
getStart()
Returns the firstKey
in the range.int
hashCode()
Iterator<Key>
iterator()
-
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-