Top Inners Fields Constructors Methods
org.hibernate.bytecode.internal.bytebuddy

public Class BytecodeProviderImpl

extends Object
implements BytecodeProvider
Class Inheritance
All Implemented Interfaces
org.hibernate.bytecode.spi.BytecodeProvider, org.hibernate.service.Service, java.io.Serializable
Imports
java.lang.reflect.Constructor, .Method, .Modifier, java.util.concurrent.Callable, org.hibernate.HibernateException, org.hibernate.bytecode.enhance.internal.bytebuddy.EnhancerImpl, org.hibernate.bytecode.enhance.spi.EnhancementContext, .Enhancer, org.hibernate.bytecode.spi.BytecodeProvider, .ProxyFactoryFactory, .ReflectionOptimizer, org.hibernate.proxy.pojo.bytebuddy.ByteBuddyProxyHelper, net.bytebuddy.ClassFileVersion, .NamingStrategy, net.bytebuddy.description.method.MethodDescription, net.bytebuddy.description.type.TypeDescription, net.bytebuddy.implementation.Implementation, .MethodCall, net.bytebuddy.implementation.bytecode.ByteCodeAppender, net.bytebuddy.implementation.bytecode.assign.Assigner, net.bytebuddy.implementation.bytecode.assign.primitive.PrimitiveBoxingDelegate, .PrimitiveUnboxingDelegate, net.bytebuddy.implementation.bytecode.assign.reference.ReferenceTypeAwareAssigner, net.bytebuddy.jar.asm.MethodVisitor, .Opcodes, .Type, net.bytebuddy.matcher.ElementMatcher, .ElementMatchers

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
private static class
private static class

Field Summary

Modifier and TypeField and Description
private final ByteBuddyProxyHelper
private final ByteBuddyState
private static final ElementMatcher.Junction<S>
private static final ElementMatcher.Junction<S>
private static final String
private static final ElementMatcher.Junction<S>
private static final String
private static final ElementMatcher.Junction<S>

Constructor Summary

AccessConstructor and Description
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 8.

public
BytecodeProviderImpl(ClassFileVersion targetCompatibleJVM)

Constructs a ByteBuddy BytecodeProvider instance which aims to produce code compatible with the specified target JVM version.

Method Summary

Modifier and TypeMethod and Description
private static Method
findAccessor(Class<T> clazz, String name, Class<T>[] params, int index)

private static void
findAccessors(Class<T> clazz, String[] getterNames, String[] setterNames, Class<T>[] types, Method[] getters, Method[] setters)

private static Constructor<?>
public ByteBuddyProxyHelper
public Enhancer
getEnhancer(EnhancementContext
The enhancement context that describes the enhancements to apply.
enhancementContext
)

Implements org.hibernate.bytecode.spi.BytecodeProvider.getEnhancer.

Returns a byte code enhancer that implements the enhancements described in the supplied enhancement context.
public ProxyFactoryFactory
getProxyFactoryFactory()

Implements org.hibernate.bytecode.spi.BytecodeProvider.getProxyFactoryFactory.

Retrieve the specific factory for this provider capable of generating run-time proxies for lazy-loading purposes.
public ReflectionOptimizer
getReflectionOptimizer(final Class<T>
The class to be reflected upon.
clazz
,
final String[]
Names of all property getters to be accessed via reflection.
getterNames
,
final String[]
Names of all property setters to be accessed via reflection.
setterNames
,
final Class<T>[]
The types of all properties to be accessed.
types
)

Implements org.hibernate.bytecode.spi.BytecodeProvider.getReflectionOptimizer.

Retrieve the ReflectionOptimizer delegate for this provider capable of generating reflection optimization components.
public void
resetCaches()

Overrides default org.hibernate.bytecode.spi.BytecodeProvider.resetCaches.

Some BytecodeProvider implementations will have classloader specific caching.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

byteBuddyProxyHelperback to summary
private final ByteBuddyProxyHelper byteBuddyProxyHelper
byteBuddyStateback to summary
private final ByteBuddyState byteBuddyState
getPropertyNamesMethodNameback to summary
private static final ElementMatcher.Junction<S> getPropertyNamesMethodName
getPropertyValuesMethodNameback to summary
private static final ElementMatcher.Junction<S> getPropertyValuesMethodName
INSTANTIATOR_PROXY_NAMING_SUFFIXback to summary
private static final String INSTANTIATOR_PROXY_NAMING_SUFFIX
newInstanceMethodNameback to summary
private static final ElementMatcher.Junction<S> newInstanceMethodName
OPTIMIZER_PROXY_NAMING_SUFFIXback to summary
private static final String OPTIMIZER_PROXY_NAMING_SUFFIX
setPropertyValuesMethodNameback to summary
private static final ElementMatcher.Junction<S> setPropertyValuesMethodName

Constructor Detail

BytecodeProviderImplback to summary
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 8.

BytecodeProviderImplback to summary
public BytecodeProviderImpl(ClassFileVersion targetCompatibleJVM)

Constructs a ByteBuddy BytecodeProvider instance which aims to produce code compatible with the specified target JVM version.

Method Detail

findAccessorback to summary
private static Method findAccessor(Class<T> clazz, String name, Class<T>[] params, int index) throws BulkAccessorException
Annotations
@SuppressWarnings:unchecked
findAccessorsback to summary
private static void findAccessors(Class<T> clazz, String[] getterNames, String[] setterNames, Class<T>[] types, Method[] getters, Method[] setters)
findConstructorback to summary
private static Constructor<?> findConstructor(Class<T> clazz)
getByteBuddyProxyHelperback to summary
public ByteBuddyProxyHelper getByteBuddyProxyHelper()
getEnhancerback to summary
public Enhancer getEnhancer(EnhancementContext enhancementContext)

Implements org.hibernate.bytecode.spi.BytecodeProvider.getEnhancer.

Doc from org.hibernate.bytecode.spi.BytecodeProvider.getEnhancer.

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.

Annotations
@Override
getProxyFactoryFactoryback to summary
public ProxyFactoryFactory getProxyFactoryFactory()

Implements org.hibernate.bytecode.spi.BytecodeProvider.getProxyFactoryFactory.

Doc from org.hibernate.bytecode.spi.BytecodeProvider.getProxyFactoryFactory.

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

Returns:ProxyFactoryFactory

The provider specific factory.

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

Implements org.hibernate.bytecode.spi.BytecodeProvider.getReflectionOptimizer.

Doc from org.hibernate.bytecode.spi.BytecodeProvider.getReflectionOptimizer.

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.

Annotations
@Override
resetCachesback to summary
public void resetCaches()

Overrides default org.hibernate.bytecode.spi.BytecodeProvider.resetCaches.

Doc from org.hibernate.bytecode.spi.BytecodeProvider.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.

Annotations
@Override
org.hibernate.bytecode.internal.bytebuddy back to summary

public Class BytecodeProviderImpl.CloningPropertyCall

extends Object
implements Callable<String[]>
Class Inheritance
  • java.lang.Object
  • org.hibernate.bytecode.internal.bytebuddy.BytecodeProviderImpl.CloningPropertyCall
All Implemented Interfaces
java.util.concurrent.Callable

Field Summary

Modifier and TypeField and Description
private final String[]

Constructor Summary

AccessConstructor and Description
private
CloningPropertyCall(String[] propertyNames)

Method Summary

Modifier and TypeMethod and Description
public String[]
call()

Implements java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

propertyNamesback to summary
private final String[] propertyNames

Constructor Detail

CloningPropertyCallback to summary
private CloningPropertyCall(String[] propertyNames)

Method Detail

callback to summary
public String[] call()

Implements java.util.concurrent.Callable.call.

Doc from java.util.concurrent.Callable.call.

Computes a result, or throws an exception if unable to do so.

Returns:String[]

computed result

Annotations
@Override
org.hibernate.bytecode.internal.bytebuddy back to summary

private Class BytecodeProviderImpl.GetPropertyValues

extends Object
implements ByteCodeAppender
Class Inheritance
  • java.lang.Object
  • org.hibernate.bytecode.internal.bytebuddy.BytecodeProviderImpl.GetPropertyValues
All Implemented Interfaces
net.bytebuddy.implementation.bytecode.ByteCodeAppender

Field Summary

Modifier and TypeField and Description
private final Class<T>
private final Method[]

Constructor Summary

AccessConstructor and Description
public
GetPropertyValues(Class<T> clazz, Method[] getters)

Method Summary

Modifier and TypeMethod and Description
public ByteCodeAppender.Size
apply(MethodVisitor
The method visitor to which the byte code appender writes its code to.
methodVisitor
,
Implementation.Context
The implementation context of the current type creation process.
implementationContext
,
MethodDescription
The method that is the target of the instrumentation.
instrumentedMethod
)

Implements net.bytebuddy.implementation.bytecode.ByteCodeAppender.apply.

Applies this byte code appender to a type creation process.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

clazzback to summary
private final Class<T> clazz
gettersback to summary
private final Method[] getters

Constructor Detail

GetPropertyValuesback to summary
public GetPropertyValues(Class<T> clazz, Method[] getters)

Method Detail

applyback to summary
public ByteCodeAppender.Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext, MethodDescription instrumentedMethod)

Implements net.bytebuddy.implementation.bytecode.ByteCodeAppender.apply.

Doc from net.bytebuddy.implementation.bytecode.ByteCodeAppender.apply.

Applies this byte code appender to a type creation process.

Parameters
methodVisitor:MethodVisitor

The method visitor to which the byte code appender writes its code to.

implementationContext:Implementation.Context

The implementation context of the current type creation process.

instrumentedMethod:MethodDescription

The method that is the target of the instrumentation.

Returns:ByteCodeAppender.Size

The required size for the applied byte code to run.

Annotations
@Override
org.hibernate.bytecode.internal.bytebuddy back to summary

private Class BytecodeProviderImpl.SetPropertyValues

extends Object
implements ByteCodeAppender
Class Inheritance
  • java.lang.Object
  • org.hibernate.bytecode.internal.bytebuddy.BytecodeProviderImpl.SetPropertyValues
All Implemented Interfaces
net.bytebuddy.implementation.bytecode.ByteCodeAppender

Field Summary

Modifier and TypeField and Description
private final Class<T>
private final Method[]

Constructor Summary

AccessConstructor and Description
public
SetPropertyValues(Class<T> clazz, Method[] setters)

Method Summary

Modifier and TypeMethod and Description
public ByteCodeAppender.Size
apply(MethodVisitor
The method visitor to which the byte code appender writes its code to.
methodVisitor
,
Implementation.Context
The implementation context of the current type creation process.
implementationContext
,
MethodDescription
The method that is the target of the instrumentation.
instrumentedMethod
)

Implements net.bytebuddy.implementation.bytecode.ByteCodeAppender.apply.

Applies this byte code appender to a type creation process.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

clazzback to summary
private final Class<T> clazz
settersback to summary
private final Method[] setters

Constructor Detail

SetPropertyValuesback to summary
public SetPropertyValues(Class<T> clazz, Method[] setters)

Method Detail

applyback to summary
public ByteCodeAppender.Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext, MethodDescription instrumentedMethod)

Implements net.bytebuddy.implementation.bytecode.ByteCodeAppender.apply.

Doc from net.bytebuddy.implementation.bytecode.ByteCodeAppender.apply.

Applies this byte code appender to a type creation process.

Parameters
methodVisitor:MethodVisitor

The method visitor to which the byte code appender writes its code to.

implementationContext:Implementation.Context

The implementation context of the current type creation process.

instrumentedMethod:MethodDescription

The method that is the target of the instrumentation.

Returns:ByteCodeAppender.Size

The required size for the applied byte code to run.

Annotations
@Override