Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/hibernate/bytecode/BytecodeProvider.java


1   package org.hibernate.bytecode;
2   
3   /**
4    * Contract for providers of bytecode services to Hibernate.
5    * <p/>
6    * Bytecode requirements break down into basically 4 areas<ol>
7    * <li>proxy generation (both for runtime-lazy-loading and basic proxy generation)
8    * {@link #getProxyFactoryFactory()}
9    * <li>bean relection optimization {@link #getReflectionOptimizer}
10   * <li>build-time instumentation (not covered by this contract)
11   * <li>class-load intrumentation {@link #generateDynamicFieldInterceptionClassLoader};
12   * (currently only used in the test suite).
13   * </ol>
14   *
15   * @author Steve Ebersole
16   */
17  public interface BytecodeProvider {
18    /**
19     * Retrieve the specific factory for this provider capable of
20     * generating run-time proxies for lazy-loading purposes.
21     *
22     * @return The provider specifc factory.
23     */
24    public ProxyFactoryFactory getProxyFactoryFactory();
25  
26    /**
27     * Retrieve the ReflectionOptimizer delegate for this provider
28     * capable of generating reflection optimization components.
29     *
30     * @param clazz The class to be reflected upon.
31     * @param getterNames Names of all property getters to be accessed via reflection.
32     * @param setterNames Names of all property setters to be accessed via reflection.
33     * @param types The types of all properties to be accessed.
34     * @return The reflection optimization delegate.
35     */
36    public ReflectionOptimizer getReflectionOptimizer(Class clazz, String[] getterNames, String[] setterNames, Class[] types);
37  
38    /**
39     * Generate a ClassLoader capable of performing dynamic bytecode manipulation
40     * on classes as they are loaded for the purpose of field-level interception.
41     * The returned ClassLoader is used for run-time bytecode manipulation as
42     * opposed to the more common build-time manipulation, since here we get
43     * into SecurityManager issues and such.
44     * <p/>
45     * Currently used only from the Hibernate test suite, although conceivably
46     * (SecurityManager concerns aside) could be used somehow in running systems.
47     *
48     * @param parent The parent classloader
49     * @param classpath The classpath to be searched
50     * @param packages can be null; use to limit the packages to be loaded
51     * via this classloader (and transformed).
52     * @return The appropriate ClassLoader.
53     */
54    public ClassLoader generateDynamicFieldInterceptionClassLoader(ClassLoader parent, String[] classpath, String[] packages);
55  
56    /**
57     * Generate a ClassTransformer capable of performing dynamic bytecode manipulation
58     * on classes as they are loaded for the purpose of field-level interception.
59     * The returned ClassTransformer can be combined to an appropriate ClassLoader
60     * is used for run-time bytecode manipulation as
61     * opposed to the more common build-time manipulation, since here we get
62     * into SecurityManager issues and such.
63     * <p/>
64     *
65     * @param packages can be null; use to limit the packages to be transformed
66     * via this classtransformer.
67     * @param classes can be null; use to limit the classes to be transformed
68     * via this class transformer.
69     * @return The appropriate ClassTransformer.
70     */
71    public ClassTransformer getEntityClassTransformer(
72        String[] packages, String[] classes
73    );
74  
75    public void releaseDynamicFieldInterceptionClassLoader(ClassLoader classLoader);
76  }