org.hibernate.bytecode
Interface BytecodeProvider

All Known Implementing Classes:
BytecodeProviderImpl, BytecodeProviderImpl

public interface BytecodeProvider

Contract for providers of bytecode services to Hibernate.

Bytecode requirements break down into basically 4 areas

  1. proxy generation (both for runtime-lazy-loading and basic proxy generation) getProxyFactoryFactory()
  2. bean relection optimization getReflectionOptimizer(java.lang.Class, java.lang.String[], java.lang.String[], java.lang.Class[])
  3. build-time instumentation (not covered by this contract)
  4. class-load intrumentation generateDynamicFieldInterceptionClassLoader(java.lang.ClassLoader, java.lang.String[], java.lang.String[]); (currently only used in the test suite).

Author:
Steve Ebersole

Method Summary
 ClassLoader generateDynamicFieldInterceptionClassLoader(ClassLoader parent, String[] classpath, String[] packages)
          Generate a ClassLoader capable of performing dynamic bytecode manipulation on classes as they are loaded for the purpose of field-level interception.
 ClassTransformer getEntityClassTransformer(String[] packages, String[] classes)
          Generate a ClassTransformer capable of performing dynamic bytecode manipulation on classes as they are loaded for the purpose of field-level interception.
 ProxyFactoryFactory getProxyFactoryFactory()
          Retrieve the specific factory for this provider capable of generating run-time proxies for lazy-loading purposes.
 ReflectionOptimizer getReflectionOptimizer(Class clazz, String[] getterNames, String[] setterNames, Class[] types)
          Retrieve the ReflectionOptimizer delegate for this provider capable of generating reflection optimization components.
 void releaseDynamicFieldInterceptionClassLoader(ClassLoader classLoader)
           
 

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 specifc factory.

getReflectionOptimizer

ReflectionOptimizer getReflectionOptimizer(Class clazz,
                                           String[] getterNames,
                                           String[] setterNames,
                                           Class[] types)
Retrieve 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.

generateDynamicFieldInterceptionClassLoader

ClassLoader generateDynamicFieldInterceptionClassLoader(ClassLoader parent,
                                                        String[] classpath,
                                                        String[] packages)
Generate a ClassLoader capable of performing dynamic bytecode manipulation on classes as they are loaded for the purpose of field-level interception. The returned ClassLoader is used for run-time bytecode manipulation as opposed to the more common build-time manipulation, since here we get into SecurityManager issues and such.

Currently used only from the Hibernate test suite, although conceivably (SecurityManager concerns aside) could be used somehow in running systems.

Parameters:
parent - The parent classloader
classpath - The classpath to be searched
packages - can be null; use to limit the packages to be loaded via this classloader (and transformed).
Returns:
The appropriate ClassLoader.

getEntityClassTransformer

ClassTransformer getEntityClassTransformer(String[] packages,
                                           String[] classes)
Generate a ClassTransformer capable of performing dynamic bytecode manipulation on classes as they are loaded for the purpose of field-level interception. The returned ClassTransformer can be combined to an appropriate ClassLoader is used for run-time bytecode manipulation as opposed to the more common build-time manipulation, since here we get into SecurityManager issues and such.

Parameters:
packages - can be null; use to limit the packages to be transformed via this classtransformer.
classes - can be null; use to limit the classes to be transformed via this class transformer.
Returns:
The appropriate ClassTransformer.

releaseDynamicFieldInterceptionClassLoader

void releaseDynamicFieldInterceptionClassLoader(ClassLoader classLoader)