Class ByteBuddyState
java.lang.Object
org.hibernate.bytecode.internal.bytebuddy.ByteBuddyState
A utility to hold all ByteBuddy related state, as in the current version of
Hibernate the Bytecode Provider state is held in a static field, yet ByteBuddy
is able to benefit from some caching and general state reuse.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Shared proxy definition helpers. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the proxy definition helpers to reuse when defining proxies.Class<?>
load
(Class<?> referenceClass, Function<net.bytebuddy.ByteBuddy, net.bytebuddy.dynamic.DynamicType.Builder<?>> makeClassFunction) Load a class generated by ByteBuddy.Class<?>
loadProxy
(Class<?> referenceClass, net.bytebuddy.TypeCache.SimpleKey cacheKey, Function<net.bytebuddy.ByteBuddy, net.bytebuddy.dynamic.DynamicType.Builder<?>> makeProxyFunction) Load a proxy as generated by theProxyFactory
.net.bytebuddy.dynamic.DynamicType.Unloaded<?>
make
(Function<net.bytebuddy.ByteBuddy, net.bytebuddy.dynamic.DynamicType.Builder<?>> makeProxyFunction) net.bytebuddy.dynamic.DynamicType.Unloaded<?>
make
(net.bytebuddy.pool.TypePool typePool, Function<net.bytebuddy.ByteBuddy, net.bytebuddy.dynamic.DynamicType.Builder<?>> makeProxyFunction) byte[]
rewrite
(net.bytebuddy.pool.TypePool typePool, String className, Function<net.bytebuddy.ByteBuddy, net.bytebuddy.dynamic.DynamicType.Builder<?>> rewriteClassFunction) Rewrite a class, used by the enhancer.
-
Constructor Details
-
ByteBuddyState
public ByteBuddyState()
-
-
Method Details
-
loadProxy
public Class<?> loadProxy(Class<?> referenceClass, net.bytebuddy.TypeCache.SimpleKey cacheKey, Function<net.bytebuddy.ByteBuddy, net.bytebuddy.dynamic.DynamicType.Builder<?>> makeProxyFunction) Load a proxy as generated by theProxyFactory
.- Parameters:
referenceClass
- The main class to proxy - might be an interface.cacheKey
- The cache key.makeProxyFunction
- A function building the proxy.- Returns:
- The loaded proxy class.
-
load
public Class<?> load(Class<?> referenceClass, Function<net.bytebuddy.ByteBuddy, net.bytebuddy.dynamic.DynamicType.Builder<?>> makeClassFunction) Load a class generated by ByteBuddy.- Parameters:
referenceClass
- The main class to proxy - might be an interface.makeClassFunction
- A function building the class.- Returns:
- The loaded generated class.
-
rewrite
public byte[] rewrite(net.bytebuddy.pool.TypePool typePool, String className, Function<net.bytebuddy.ByteBuddy, net.bytebuddy.dynamic.DynamicType.Builder<?>> rewriteClassFunction) Rewrite a class, used by the enhancer.WARNING: Returns null if rewriteClassFunction returns a null builder. Do not use if you expect the original content.
- Parameters:
typePool
- the ByteBuddy TypePoolclassName
- The original class name.rewriteClassFunction
- The function used to rewrite the class.- Returns:
- The rewritten content of the class or null if rewriteClassFunction returns a null builder.
-
getProxyDefinitionHelpers
Returns the proxy definition helpers to reuse when defining proxies.These elements are shared as they are immutable.
- Returns:
- The proxy definition helpers.
-
make
public net.bytebuddy.dynamic.DynamicType.Unloaded<?> make(Function<net.bytebuddy.ByteBuddy, net.bytebuddy.dynamic.DynamicType.Builder<?>> makeProxyFunction) -
make
public net.bytebuddy.dynamic.DynamicType.Unloaded<?> make(net.bytebuddy.pool.TypePool typePool, Function<net.bytebuddy.ByteBuddy, net.bytebuddy.dynamic.DynamicType.Builder<?>> makeProxyFunction) -
getEnhancerConstants
-