Package javax.jdo
Interface Extent<E>
-
- All Superinterfaces:
AutoCloseable
,Iterable<E>
public interface Extent<E> extends AutoCloseable, Iterable<E>
Instances of theExtent
class represent the entire collection of instances in the data store of the candidate class or interface possibly including its subclasses or subinterfaces.The
Extent
instance has two possible uses:- to iterate all instances of a particular class or interface
- to execute a
Query
in the data store over all instances of a particular class or interface
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Don't use this method directly; usecloseAll()
instead.void
close(Iterator<E> it)
Close anIterator
associated with thisExtent
instance.void
closeAll()
Close allIterator
s associated with thisExtent
instance.Class<E>
getCandidateClass()
AnExtent
contains all instances of a particular class or interface in the data store; this method returns theClass
of the instances represented by this Extent.FetchPlan
getFetchPlan()
Get the fetch plan associated with this Extent.PersistenceManager
getPersistenceManager()
AnExtent
is managed by aPersistenceManager
; this method gives access to the owningPersistenceManager
.boolean
hasSubclasses()
Returns whether thisExtent
was defined to contain subclasses.Iterator<E>
iterator()
Returns an iterator over all the instances in theExtent
.-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
iterator
Iterator<E> iterator()
Returns an iterator over all the instances in theExtent
. The behaviour of the returned iterator might depend on the setting of theignoreCache
flag in the owningPersistenceManager
.
-
hasSubclasses
boolean hasSubclasses()
Returns whether thisExtent
was defined to contain subclasses.- Returns:
- true if this
Extent
was defined to contain instances that are of a subclass type.
-
getCandidateClass
Class<E> getCandidateClass()
AnExtent
contains all instances of a particular class or interface in the data store; this method returns theClass
of the instances represented by this Extent.- Returns:
- the
Class
of instances of thisExtent
.
-
getPersistenceManager
PersistenceManager getPersistenceManager()
AnExtent
is managed by aPersistenceManager
; this method gives access to the owningPersistenceManager
.- Returns:
- the owning
PersistenceManager
-
closeAll
void closeAll()
Close allIterator
s associated with thisExtent
instance.Iterator
s closed by this method will returnfalse
tohasNext()
and will throwNoSuchElementException
onnext()
. TheExtent
instance can still be used as a parameter ofQuery.setExtent
, and to get anIterator
.
-
close
void close(Iterator<E> it)
Close anIterator
associated with thisExtent
instance.Iterator
s closed by this method will returnfalse
tohasNext()
and will throwNoSuchElementException
onnext()
. TheExtent
instance can still be used as a parameter ofQuery.setExtent
, and to get anIterator
.- Parameters:
it
- anIterator
obtained by the methoditerator()
on thisExtent
instance.
-
close
void close() throws Exception
Don't use this method directly; usecloseAll()
instead. It is intended for use with try-with-resources.- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
- if this resource cannot be closed
-
getFetchPlan
FetchPlan getFetchPlan()
Get the fetch plan associated with this Extent.- Returns:
- the fetch plan
- Since:
- 2.0
-
-