Package org.hibernate.bytecode.spi
Interface BytecodeProvider
-
- All Superinterfaces:
Serializable
,Service
- All Known Implementing Classes:
BytecodeProviderImpl
,BytecodeProviderImpl
@JavaServiceLoadable public interface BytecodeProvider extends Service
Contract for providers of bytecode services to Hibernate.Bytecode requirements break down into the following areas
- proxy generation (both for runtime-lazy-loading and basic proxy generation)
getProxyFactoryFactory()
- bean reflection optimization
getReflectionOptimizer(java.lang.Class, java.lang.String[], java.lang.String[], java.lang.Class[])
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description @Nullable Enhancer
getEnhancer(EnhancementContext enhancementContext)
Returns a byte code enhancer that implements the enhancements described in the supplied enhancement context.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)
Deprecated, for removal: This API element is subject to removal in a future version.UsegetReflectionOptimizer(Class, Map)
inssteaddefault void
resetCaches()
Some BytecodeProvider implementations will have classloader specific caching.
-
-
-
Method Detail
-
getProxyFactoryFactory
ProxyFactoryFactory getProxyFactoryFactory()
Retrieve the specific factory for this provider capable of generating run-time proxies for lazy-loading purposes.- Returns:
- The provider specific factory.
-
getReflectionOptimizer
@Deprecated(forRemoval=true) ReflectionOptimizer getReflectionOptimizer(Class clazz, String[] getterNames, String[] setterNames, Class[] types)
Deprecated, for removal: This API element is subject to removal in a future version.UsegetReflectionOptimizer(Class, Map)
inssteadRetrieve the ReflectionOptimizer delegate for this provider capable of generating reflection optimization components.- 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
@Nullable ReflectionOptimizer getReflectionOptimizer(Class<?> clazz, Map<String,PropertyAccess> propertyAccessMap)
Retrieve the ReflectionOptimizer delegate for this provider capable of generating reflection optimization components.- Parameters:
clazz
- The class to be reflected upon.propertyAccessMap
- The ordered property access map- Returns:
- The reflection optimization delegate.
-
getEnhancer
@Nullable Enhancer getEnhancer(EnhancementContext enhancementContext)
Returns a byte code enhancer that implements the enhancements described in the supplied enhancement context.- Parameters:
enhancementContext
- The enhancement context that describes the enhancements to apply.- Returns:
- An enhancer to perform byte code manipulations.
-
resetCaches
default void resetCaches()
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.
-
-