Package org.apache.openjpa.kernel
Class AbstractPCResultObjectProvider
java.lang.Object
org.apache.openjpa.kernel.AbstractPCResultObjectProvider
- All Implemented Interfaces:
PCResultObjectProvider
,ResultObjectProvider
,Closeable
public abstract class AbstractPCResultObjectProvider
extends Object
implements PCResultObjectProvider
Abstract implementation of
PCResultObjectProvider
that implements ResultObjectProvider.getResultObject()
by assembling the necessary information about the object to be loaded.- Author:
- Patrick Linskey
-
Field Summary
Modifier and TypeFieldDescriptionprotected final StoreContext
TheStoreContext
that this result object provider will load objects into. -
Constructor Summary
ConstructorDescriptionCreate a new provider for loading PC objects from the input intoctx
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
absolute
(int pos) Override if desired.void
close()
Override if desired.Return the context this provider was constructed with.protected abstract Object
getObjectId
(ClassMetaData meta) Implement this method to extract the object id value from the current record of the input.protected abstract Class
Implement this method to extract the type of the pc stored in the current record of the input.Instantiate the current result object.void
Throws aStoreException
by default.void
initialize
(OpenJPAStateManager sm, PCState state, FetchConfiguration fetch) Initializes the state manager.protected abstract void
load
(OpenJPAStateManager sm, FetchConfiguration fetch) Load data from the current input record into the given state manager.abstract boolean
next()
Implement this method to advance the input.void
open()
Override if desired.void
reset()
Override if desired.int
size()
Override if desired.boolean
Override if desired.
-
Field Details
-
ctx
TheStoreContext
that this result object provider will load objects into.
-
-
Constructor Details
-
AbstractPCResultObjectProvider
Create a new provider for loading PC objects from the input intoctx
.
-
-
Method Details
-
getContext
Return the context this provider was constructed with. -
initialize
public void initialize(OpenJPAStateManager sm, PCState state, FetchConfiguration fetch) throws Exception Description copied from interface:PCResultObjectProvider
Initializes the state manager. -
getResultObject
Description copied from interface:ResultObjectProvider
Instantiate the current result object. This method will only be called afterResultObjectProvider.next()
orResultObjectProvider.absolute(int)
.- Specified by:
getResultObject
in interfaceResultObjectProvider
- Throws:
Exception
-
getObjectId
Implement this method to extract the object id value from the current record of the input.- Throws:
Exception
-
getPCType
Implement this method to extract the type of the pc stored in the current record of the input.- Throws:
Exception
-
load
Load data from the current input record into the given state manager. Remember to callOpenJPAStateManager.setVersion(java.lang.Object)
to set the optimistic versioning information, if it has any.- Throws:
Exception
-
open
Override if desired. Does nothing by default.- Specified by:
open
in interfaceResultObjectProvider
- Throws:
Exception
-
supportsRandomAccess
public boolean supportsRandomAccess()Override if desired. Returns false by default.- Specified by:
supportsRandomAccess
in interfaceResultObjectProvider
- See Also:
-
next
Implement this method to advance the input.- Specified by:
next
in interfaceResultObjectProvider
- Throws:
Exception
- See Also:
-
absolute
Override if desired. Throws an exception by default.- Specified by:
absolute
in interfaceResultObjectProvider
- Throws:
Exception
- See Also:
-
size
Override if desired. ReturnsInteger.MAX_VALUE
by default.- Specified by:
size
in interfaceResultObjectProvider
- Throws:
Exception
- See Also:
-
reset
Override if desired. Throws an exception by default.- Specified by:
reset
in interfaceResultObjectProvider
- Throws:
Exception
- See Also:
-
close
Override if desired. Does nothing by default.- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceResultObjectProvider
- Throws:
Exception
- See Also:
-
handleCheckedException
Throws aStoreException
by default.- Specified by:
handleCheckedException
in interfaceResultObjectProvider
-