Package org.apache.openjpa.lib.rop
Interface ResultObjectProvider
-
- All Superinterfaces:
Closeable
- All Known Subinterfaces:
BatchedResultObjectProvider
- All Known Implementing Classes:
ListResultObjectProvider,MergedResultObjectProvider,RangeResultObjectProvider
public interface ResultObjectProvider extends Closeable
Interface that allows lazy/custom instantiation of input objects.ResultListobjects do not necessarily load in data all at once. Instead, they may lazily load objects as necessary. So, the lifespan of aResultObjectProviderinstance is related to how the application deals with processing theResultListcreated with a givenResultObjectProviderinstance.- Author:
- Marc Prud'hommeaux, Patrick Linskey, Abe White
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanabsolute(int pos)Move to the given 0-based position.voidclose()Free the resources associated with this provider.ObjectgetResultObject()Instantiate the current result object.voidhandleCheckedException(Exception e)Any checked exceptions that are thrown will be passed to this method.booleannext()Advance the input to the next position.voidopen()Open the result.voidreset()Reset this provider.intsize()Return the number of items in the input, orInteger.MAX_VALUEif the size in unknown.booleansupportsRandomAccess()Return true if this provider supports random access.
-
-
-
Method Detail
-
supportsRandomAccess
boolean supportsRandomAccess()
Return true if this provider supports random access.
-
getResultObject
Object getResultObject() throws Exception
Instantiate the current result object. This method will only be called afternext()orabsolute(int).- Throws:
Exception
-
next
boolean next() throws ExceptionAdvance the input to the next position. Returntrueif there is more data; otherwisefalse.- Throws:
Exception
-
absolute
boolean absolute(int pos) throws ExceptionMove to the given 0-based position. This method is only called for providers that support random access. Returntrueif there is data at this position; otherwisefalse. This may be invoked in place ofnext().- Throws:
Exception
-
size
int size() throws Exception
Return the number of items in the input, orInteger.MAX_VALUEif the size in unknown.- Throws:
Exception
-
reset
void reset() throws ExceptionReset 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:
Exception
-
close
void close() throws ExceptionFree the resources associated with this provider.
-
handleCheckedException
void handleCheckedException(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.
-
-