Class BytecodeProviderImpl
- java.lang.Object
-
- org.hibernate.bytecode.internal.bytebuddy.BytecodeProviderImpl
-
- All Implemented Interfaces:
Serializable
,BytecodeProvider
,Service
public class BytecodeProviderImpl extends Object implements BytecodeProvider
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BytecodeProviderImpl.CloningPropertyCall
-
Constructor Summary
Constructors Constructor Description BytecodeProviderImpl()
Constructs a ByteBuddy BytecodeProvider instance which attempts to auto-detect the target JVM version from the currently running one, with a fallback on Java 11.BytecodeProviderImpl(net.bytebuddy.ClassFileVersion targetCompatibleJVM)
Constructs a ByteBuddy BytecodeProvider instance which aims to produce code compatible with the specified target JVM version.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteBuddyProxyHelper
getByteBuddyProxyHelper()
@Nullable Enhancer
getEnhancer(EnhancementContext enhancementContext)
Returns a byte code enhancer that implements the enhancements described in the supplied enhancement context.@Nullable Enhancer
getEnhancer(EnhancementContext enhancementContext, EnhancerClassLocator classLocator)
Similar togetEnhancer(EnhancementContext)
but intended for advanced users who wish to customize how ByteBuddy is locating the class files and caching the types.ProxyFactoryFactory
getProxyFactoryFactory()
Retrieve the specific factory for this provider capable of generating run-time proxies for lazy-loading purposes.@Nullable ReflectionOptimizer
getReflectionOptimizer(Class<?> clazz, Map<String,PropertyAccess> propertyAccessMap)
Retrieve the ReflectionOptimizer delegate for this provider capable of generating reflection optimization components.ReflectionOptimizer
getReflectionOptimizer(Class clazz, String[] getterNames, String[] setterNames, Class[] types)
Retrieve the ReflectionOptimizer delegate for this provider capable of generating reflection optimization components.void
resetCaches()
Some BytecodeProvider implementations will have classloader specific caching.
-
-
-
Constructor Detail
-
BytecodeProviderImpl
public BytecodeProviderImpl()
Constructs a ByteBuddy BytecodeProvider instance which attempts to auto-detect the target JVM version from the currently running one, with a fallback on Java 11.
-
BytecodeProviderImpl
public BytecodeProviderImpl(net.bytebuddy.ClassFileVersion targetCompatibleJVM)
Constructs a ByteBuddy BytecodeProvider instance which aims to produce code compatible with the specified target JVM version.
-
-
Method Detail
-
getProxyFactoryFactory
public ProxyFactoryFactory getProxyFactoryFactory()
Description copied from interface:BytecodeProvider
Retrieve the specific factory for this provider capable of generating run-time proxies for lazy-loading purposes.- Specified by:
getProxyFactoryFactory
in interfaceBytecodeProvider
- Returns:
- The provider specific factory.
-
getReflectionOptimizer
public ReflectionOptimizer getReflectionOptimizer(Class clazz, String[] getterNames, String[] setterNames, Class[] types)
Description copied from interface:BytecodeProvider
Retrieve the ReflectionOptimizer delegate for this provider capable of generating reflection optimization components.- Specified by:
getReflectionOptimizer
in interfaceBytecodeProvider
- Parameters:
clazz
- The class to be reflected upon.getterNames
- Names of all property getters to be accessed via reflection.setterNames
- Names of all property setters to be accessed via reflection.types
- The types of all properties to be accessed.- Returns:
- The reflection optimization delegate.
-
getReflectionOptimizer
public @Nullable ReflectionOptimizer getReflectionOptimizer(Class<?> clazz, Map<String,PropertyAccess> propertyAccessMap)
Description copied from interface:BytecodeProvider
Retrieve the ReflectionOptimizer delegate for this provider capable of generating reflection optimization components.- Specified by:
getReflectionOptimizer
in interfaceBytecodeProvider
- Parameters:
clazz
- The class to be reflected upon.propertyAccessMap
- The ordered property access map- Returns:
- The reflection optimization delegate.
-
getByteBuddyProxyHelper
public ByteBuddyProxyHelper getByteBuddyProxyHelper()
-
getEnhancer
public @Nullable Enhancer getEnhancer(EnhancementContext enhancementContext)
Description copied from interface:BytecodeProvider
Returns a byte code enhancer that implements the enhancements described in the supplied enhancement context.- Specified by:
getEnhancer
in interfaceBytecodeProvider
- Parameters:
enhancementContext
- The enhancement context that describes the enhancements to apply.- Returns:
- An enhancer to perform byte code manipulations.
-
getEnhancer
public @Nullable Enhancer getEnhancer(EnhancementContext enhancementContext, EnhancerClassLocator classLocator)
Similar togetEnhancer(EnhancementContext)
but intended for advanced users who wish to customize how ByteBuddy is locating the class files and caching the types. Possibly used in Quarkus in a future version.- Parameters:
enhancementContext
-classLocator
-- Returns:
-
resetCaches
public void resetCaches()
Description copied from interface:BytecodeProvider
Some BytecodeProvider implementations will have classloader specific caching. These caches are useful at runtime but need to be reset at least on SessionFactory shutdown to prevent leaking the deployment classloader. Since the BytecodeProvider is static these caches are potentially shared across multiple deployments; in this case we'll clear all caches which might show as a small, temporary performance degradation on the SessionFactory instances which haven't been closed. This limitation will be removed in the future, when these providers will no longer be static.- Specified by:
resetCaches
in interfaceBytecodeProvider
-
-