Package com.blazebit.query
Interface QueryContext
- All Superinterfaces:
AutoCloseable
Context object for creating query sessions.
When the application has finished using the QueryContext,
and/or at application shutdown, the application should
close the QueryContext. Once a QueryContext has been closed,
all its
QuerySession
objects are considered to be in the closed state.
The object is thread-safe and should be reused instead of rebuilt, since it is heavyweight.- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes the QueryContext and all associatedQuerySession
to free up resources.default QuerySession
Creates a newQuerySession
with default configuration.createSession
(Map<String, Object> properties) Creates a newQuerySession
.Returns the metamodel of this QueryContext.boolean
isOpen()
Returns whether the QueryContext is open.<T> T
Return an object of the specified type to allow access to the provider-specific API.
-
Method Details
-
createSession
Creates a newQuerySession
with default configuration.- Returns:
- a new
QuerySession
- Throws:
IllegalStateException
- if the QueryContext has already been closed
-
createSession
Creates a newQuerySession
. The given configuration properties will override the default configuration if possible.- Parameters:
properties
- Additional configuration that overrides the default configuration if possible- Returns:
- a new
QuerySession
- Throws:
IllegalStateException
- if the QueryContext has already been closed
-
getMetamodel
Metamodel getMetamodel()Returns the metamodel of this QueryContext.- Returns:
- The metamodel of this QueryContext
-
unwrap
Return an object of the specified type to allow access to the provider-specific API. If the implementation does not support the specified class, theIllegalArgumentException
is thrown.- Type Parameters:
T
- The return type- Parameters:
cls
- the class of the object to be returned- Returns:
- The unwrapped object
- Throws:
IllegalArgumentException
- if the type is not supported
-
isOpen
boolean isOpen()Returns whether the QueryContext is open.- Returns:
- Whether the QueryContext is open
-
close
void close()Closes the QueryContext and all associatedQuerySession
to free up resources.- Specified by:
close
in interfaceAutoCloseable
- Throws:
IllegalStateException
- if the QueryContext has already been closed
-