Top Description Methods
org.hibernate.bytecode.spi

public Interface BytecodeProvider

extends Service
Known Direct Implementers
org.hibernate.bytecode.internal.bytebuddy.BytecodeProviderImpl, org.hibernate.bytecode.internal.none.BytecodeProviderImpl
Imports
org.hibernate.bytecode.enhance.spi.EnhancementContext, .Enhancer, org.hibernate.service.Service

Contract for providers of bytecode services to Hibernate.

Bytecode requirements break down into the following areas

  1. proxy generation (both for runtime-lazy-loading and basic proxy generation) getProxyFactoryFactory()
  2. bean reflection optimization getReflectionOptimizer
Author
Steve Ebersole

Method Summary

Modifier and TypeMethod and Description
public Enhancer

Returns:

An enhancer to perform byte code manipulations.
getEnhancer
(EnhancementContext
The enhancement context that describes the enhancements to apply.
enhancementContext
)

Returns a byte code enhancer that implements the enhancements described in the supplied enhancement context.

public ProxyFactoryFactory

Returns:

The provider specific factory.
getProxyFactoryFactory
()

Retrieve the specific factory for this provider capable of generating run-time proxies for lazy-loading purposes.

public ReflectionOptimizer

Returns:

The reflection optimization delegate.
getReflectionOptimizer
(Class<T>
The class to be reflected upon.
clazz
,
String[]
Names of all property getters to be accessed via reflection.
getterNames
,
String[]
Names of all property setters to be accessed via reflection.
setterNames
,
Class<T>[]
The types of all properties to be accessed.
types
)

Retrieve the ReflectionOptimizer delegate for this provider capable of generating reflection optimization components.

public default void
resetCaches()

Some BytecodeProvider implementations will have classloader specific caching.

Method Detail

getEnhancerback to summary
public Enhancer getEnhancer(EnhancementContext enhancementContext)

Returns a byte code enhancer that implements the enhancements described in the supplied enhancement context.

Parameters
enhancementContext:EnhancementContext

The enhancement context that describes the enhancements to apply.

Returns:Enhancer

An enhancer to perform byte code manipulations.

getProxyFactoryFactoryback to summary
public ProxyFactoryFactory getProxyFactoryFactory()

Retrieve the specific factory for this provider capable of generating run-time proxies for lazy-loading purposes.

Returns:ProxyFactoryFactory

The provider specific factory.

getReflectionOptimizerback to summary
public ReflectionOptimizer getReflectionOptimizer(Class<T> clazz, String[] getterNames, String[] setterNames, Class<T>[] types)

Retrieve the ReflectionOptimizer delegate for this provider capable of generating reflection optimization components.

Parameters
clazz:Class<T>

The class to be reflected upon.

getterNames:String[]

Names of all property getters to be accessed via reflection.

setterNames:String[]

Names of all property setters to be accessed via reflection.

types:Class<T>[]

The types of all properties to be accessed.

Returns:ReflectionOptimizer

The reflection optimization delegate.

resetCachesback to summary
public 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.