com.uwyn.rife.database.querymanagers.generic.instrument
Class LazyLoadAccessorsBytecodeTransformer

java.lang.Object
  extended by com.uwyn.rife.database.querymanagers.generic.instrument.LazyLoadAccessorsBytecodeTransformer

public abstract class LazyLoadAccessorsBytecodeTransformer
extends Object

This utility class will modify property accessors of classes that implement the Constrained interface and add lazy loading for properties with manyToOne constraints.

This is done by modifying the bytecode of the getters by checking if the value that is returned is null, and in that case performing the actual database call to fetch the property value. After that, the property value is stored in a map that is stored in an added class field so that it will not be fetched at subsequent calls of the getter. The setter is modified to remove the values from this map when it is executed, so that users can still provide their own values for the properties.

WARNING: this class is not supposed to be used directly, it is made public since the general RIFE EngineClassLoader has to be able to access it.

Since:
1.6
Version:
$Revision: 3685 $
Author:
Geert Bevin (gbevin[remove] at uwyn dot com)

Field Summary
static String GQM_VAR_NAME
          The name of the synthentic class field that will be added so that the instance of the GenericQueryManager that restored the bean can be used afterwards to lazily load the relations.
static String LAZYLOADED_VAR_NAME
          The name of the synthentic class field that will be added so that already restored lazy relations can be cached.
 
Constructor Summary
LazyLoadAccessorsBytecodeTransformer()
           
 
Method Summary
static byte[] addLazyLoadToBytes(byte[] origBytes)
          Performs the actual modification of the bean class's bytecode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GQM_VAR_NAME

public static final String GQM_VAR_NAME
The name of the synthentic class field that will be added so that the instance of the GenericQueryManager that restored the bean can be used afterwards to lazily load the relations.

See Also:
Constant Field Values

LAZYLOADED_VAR_NAME

public static final String LAZYLOADED_VAR_NAME
The name of the synthentic class field that will be added so that already restored lazy relations can be cached.

See Also:
Constant Field Values
Constructor Detail

LazyLoadAccessorsBytecodeTransformer

public LazyLoadAccessorsBytecodeTransformer()
Method Detail

addLazyLoadToBytes

public static byte[] addLazyLoadToBytes(byte[] origBytes)
Performs the actual modification of the bean class's bytecode.

Parameters:
origBytes - the bytes of the bean class that should be modified
Returns:
the modified bytes
Since:
1.6


Copyright © 2001-2007 Uwyn sprl/bvba. All Rights Reserved.