Package org.apache.openjpa.lib.rop
Interface ResultObjectProvider
-
- All Superinterfaces:
Closeable
- All Known Subinterfaces:
BatchedResultObjectProvider
,PCResultObjectProvider
- All Known Implementing Classes:
AbstractPCResultObjectProvider
,GenericResultObjectProvider
,InstanceResultObjectProvider
,ListResultObjectProvider
,MergedResultObjectProvider
,OrderingMergedResultObjectProvider
,PagingResultObjectProvider
,PreparedResultObjectProvider
,QueryImpl.PackingResultObjectProvider
,RangeResultObjectProvider
,SelectResultObjectProvider
,UniqueResultObjectProvider
,XROP
public interface ResultObjectProvider extends Closeable
Interface that allows lazy/custom instantiation of input objects.ResultList
objects do not necessarily load in data all at once. Instead, they may lazily load objects as necessary. So, the lifespan of aResultObjectProvider
instance is related to how the application deals with processing theResultList
created with a givenResultObjectProvider
instance.- Author:
- Marc Prud'hommeaux, Patrick Linskey, Abe White
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
absolute(int pos)
Move to the given 0-based position.void
close()
Free the resources associated with this provider.java.lang.Object
getResultObject()
Instantiate the current result object.void
handleCheckedException(java.lang.Exception e)
Any checked exceptions that are thrown will be passed to this method.boolean
next()
Advance the input to the next position.void
open()
Open the result.void
reset()
Reset this provider.int
size()
Return the number of items in the input, orInteger.MAX_VALUE
if the size in unknown.boolean
supportsRandomAccess()
Return true if this provider supports random access.
-
-
-
Method Detail
-
supportsRandomAccess
boolean supportsRandomAccess()
Return true if this provider supports random access.
-
open
void open() throws java.lang.Exception
- Throws:
java.lang.Exception
-
getResultObject
java.lang.Object getResultObject() throws java.lang.Exception
Instantiate the current result object. This method will only be called afternext()
orabsolute(int)
.- Throws:
java.lang.Exception
-
next
boolean next() throws java.lang.Exception
Advance the input to the next position. Returntrue
if there is more data; otherwisefalse
.- Throws:
java.lang.Exception
-
absolute
boolean absolute(int pos) throws java.lang.Exception
Move to the given 0-based position. This method is only called for providers that support random access. Returntrue
if there is data at this position; otherwisefalse
. This may be invoked in place ofnext()
.- Throws:
java.lang.Exception
-
size
int size() throws java.lang.Exception
Return the number of items in the input, orInteger.MAX_VALUE
if the size in unknown.- Throws:
java.lang.Exception
-
reset
void reset() throws java.lang.Exception
Reset this provider. This is an optional operation. If supported, it should move the position of the provider to before the first element. Non-random-access providers may be able to support this method by re-acquiring all resources as if the result were just opened.- Throws:
java.lang.Exception
-
close
void close() throws java.lang.Exception
Free the resources associated with this provider.
-
handleCheckedException
void handleCheckedException(java.lang.Exception e)
Any checked exceptions that are thrown will be passed to this method. The provider should re-throw the exception as an appropriate unchecked exception.
-
-