Interface EnhancementSession
- All Superinterfaces:
AutoCloseable
Owns discovery and metadata for one model and bytecode environment.
Close and invalidation require that no operation is in progress.
Closing a session invalidates its enhancers but does not close borrowed resources.
- Since:
- 8.0
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Releases session-owned metadata and invalidates all enhancers created by this session.createEnhancer(EnhancementOptions options) Creates an enhancer with its own generation options, using this session's model and metadata.voiddiscoverTypes(String className, byte[] originalBytes) Schedules a managed class and discovers its persistence types, including embedded types and mapped superclasses.voidDiscards cached bytecode descriptions and getter metadata after resources change, for example between managed and client build-time passes.
-
Method Details
-
createEnhancer
Creates an enhancer with its own generation options, using this session's model and metadata. The options must remain stable while the enhancer is used.- Parameters:
options- generation choices independent of the persistence model- Returns:
- an enhancer whose lifetime is bounded by this session
- Throws:
IllegalStateException- if this session has been closed
-
discoverTypes
Schedules a managed class and discovers its persistence types, including embedded types and mapped superclasses. This does not generate enhanced bytes.- Parameters:
className- the class name in binary or JVM internal formoriginalBytes- class-file bytes, or null to resolve them through the environment- Throws:
EnhancementException- if discovery failsIllegalStateException- if this session has been closed
-
invalidateMetadata
void invalidateMetadata()Discards cached bytecode descriptions and getter metadata after resources change, for example between managed and client build-time passes. Candidate names and discovered persistence classifications remain available. Replacing persistence mappings requires a new session rather than cache invalidation.
No session operation may be in progress when this method is called.
- Throws:
IllegalStateException- if this session has been closed
-
close
void close()Releases session-owned metadata and invalidates all enhancers created by this session. Does not close borrowed environments, locators, or class loaders. Repeated calls have no effect. No session operation may be in progress.- Specified by:
closein interfaceAutoCloseable
-