Interface Enhancer
public interface Enhancer
Class responsible for performing enhancement.
-
Method Summary
Modifier and TypeMethodDescriptionvoiddiscoverTypes(String className, byte[] originalBytes) Discovers types prior to enhancement.byte[]Performs the enhancement.default byte[]enhanceClient(String className, byte[] originalBytes) Rewrites direct accesses to fields of enhanced managed classes, without adding managed-class state to the client.
-
Method Details
-
enhance
Performs the enhancement. It is possible to invoke this method concurrently, but when doing so make sure no two enhancement tasks are invoked on the same class in parallel: the Enhancer implementations are not required to guard against this.- Parameters:
className- The name of the class whose bytecode is being enhanced.originalBytes- The class's original (pre-enhancement) byte code- Returns:
- The enhanced bytecode. If the original bytes are not enhanced, null is returned.
- Throws:
EnhancementException- Indicates a problem performing the enhancement
-
enhanceClient
Rewrites direct accesses to fields of enhanced managed classes, without adding managed-class state to the client. Targets must have been discovered for managed enhancement, or already have compatible enhancement. Returns null if no instructions change. Supports concurrent calls for different classes, with the same restriction asenhance(String, byte[]).- Throws:
EnhancementException- Since:
- 8.0
-
discoverTypes
Discovers types prior to enhancement. It is possible to invoke this method concurrently.- Parameters:
className- The name of the class whose bytecode is being analyzed for type discovery.originalBytes- The class's original (pre-enhancement) byte code- Throws:
EnhancementException- Indicates a problem during type discovery- Since:
- 6.3
-