Package org.apache.openjpa.lib.rop
Class MergedResultObjectProvider
java.lang.Object
org.apache.openjpa.lib.rop.MergedResultObjectProvider
- All Implemented Interfaces:
ResultObjectProvider,Closeable
- Direct Known Subclasses:
OrderingMergedResultObjectProvider
A result object provider that merges multiple result object provider
delegates. Support exists for maintaining ordering of the internally held
results, provided that each of the individual results is itself ordered.
- Author:
- Abe White, Marc Prud'hommeaux
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor.MergedResultObjectProvider(ResultObjectProvider[] rops, Comparator comp) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanabsolute(int pos) Move to the given 0-based position.voidclose()Free the resources associated with this provider.protected ObjectgetOrderingValue(Object val, int idx, ResultObjectProvider rop) Return the value to use for ordering on the given result value.Instantiate the current result object.voidAny 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.booleanReturn true if this provider supports random access.
-
Constructor Details
-
MergedResultObjectProvider
Constructor. Provide delegates. -
MergedResultObjectProvider
Constructor. Provide delegates and optional comparator.
-
-
Method Details
-
supportsRandomAccess
public boolean supportsRandomAccess()Description copied from interface:ResultObjectProviderReturn true if this provider supports random access.- Specified by:
supportsRandomAccessin interfaceResultObjectProvider
-
open
Description copied from interface:ResultObjectProviderOpen the result. This will be called beforeResultObjectProvider.next(),ResultObjectProvider.absolute(int), orResultObjectProvider.size().- Specified by:
openin interfaceResultObjectProvider- Throws:
Exception
-
absolute
Description copied from interface:ResultObjectProviderMove 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 ofResultObjectProvider.next().- Specified by:
absolutein interfaceResultObjectProvider- Throws:
Exception
-
size
Description copied from interface:ResultObjectProviderReturn the number of items in the input, orInteger.MAX_VALUEif the size in unknown.- Specified by:
sizein interfaceResultObjectProvider- Throws:
Exception
-
reset
Description copied from interface:ResultObjectProviderReset 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.- Specified by:
resetin interfaceResultObjectProvider- Throws:
Exception
-
close
Description copied from interface:ResultObjectProviderFree the resources associated with this provider.- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceResultObjectProvider- Throws:
Exception
-
handleCheckedException
Description copied from interface:ResultObjectProviderAny checked exceptions that are thrown will be passed to this method. The provider should re-throw the exception as an appropriate unchecked exception.- Specified by:
handleCheckedExceptionin interfaceResultObjectProvider
-
next
Description copied from interface:ResultObjectProviderAdvance the input to the next position. Returntrueif there is more data; otherwisefalse.- Specified by:
nextin interfaceResultObjectProvider- Throws:
Exception
-
getResultObject
Description copied from interface:ResultObjectProviderInstantiate the current result object. This method will only be called afterResultObjectProvider.next()orResultObjectProvider.absolute(int).- Specified by:
getResultObjectin interfaceResultObjectProvider- Throws:
Exception
-
getOrderingValue
Return the value to use for ordering on the given result value. Returns the result value by default.- Parameters:
val- the result valueidx- the index of the result object provider in the array given on construction that produced the result valuerop- the result object provider that produced the result value
-