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

public 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

public 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

public 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 limnit the packages to be loaded via this classloader (and transformed).
Returns:
The appropriate ClassLoader.

releaseDynamicFieldInterceptionClassLoader

public void releaseDynamicFieldInterceptionClassLoader(ClassLoader classLoader)