it.amattioli.dominate.lazy
Class LazyEntity<I extends Serializable>

Show UML class diagram
java.lang.Object
  extended by it.amattioli.dominate.lazy.LazyEntity<I>
Type Parameters:
I -
All Implemented Interfaces:
net.sf.cglib.proxy.Callback, net.sf.cglib.proxy.MethodInterceptor

public class LazyEntity<I extends Serializable>
extends Object
implements net.sf.cglib.proxy.MethodInterceptor

A CGLib method interceptor for lazy loaded entities. Using the static newInstance(Class, Serializable) method you can create instances of an entity class whose state can be loaded from the repository only when needed.

Author:
andrea

Constructor Summary
LazyEntity(Class<? extends Entity<I>> entityClass, I id)
           
 
Method Summary
 Object intercept(Object object, Method method, Object[] args, net.sf.cglib.proxy.MethodProxy methodProxy)
           
static
<I extends Serializable,T extends Entity<I>>
T
newInstance(Class<T> entityClass, I id)
          Create a new instance of an entity class whose state can be loaded from the repository only when needed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LazyEntity

public LazyEntity(Class<? extends Entity<I>> entityClass,
                  I id)
Method Detail

newInstance

public static <I extends Serializable,T extends Entity<I>> T newInstance(Class<T> entityClass,
                                                                         I id)
Create a new instance of an entity class whose state can be loaded from the repository only when needed.

Type Parameters:
I - The class of the entity id
T - The class of the entity
Parameters:
entityClass - The class object of the entity
id - The entity id
Returns:

intercept

public Object intercept(Object object,
                        Method method,
                        Object[] args,
                        net.sf.cglib.proxy.MethodProxy methodProxy)
                 throws Throwable
Specified by:
intercept in interface net.sf.cglib.proxy.MethodInterceptor
Throws:
Throwable


Copyright © 2011. All Rights Reserved.