org.julp
Class CGLibInstantiator<T>

java.lang.Object
  extended by org.julp.CGLibInstantiator<T>
All Implemented Interfaces:
java.io.Serializable, Instantiator<T>

public class CGLibInstantiator<T>
extends java.lang.Object
implements Instantiator<T>

CGLibInstantiator instantiates class and enhances it to make it persistable. Also it can enhanced already instantiated class. Keep in mind the class name of instantiated or enhanced object will be different. In fact it will be descendant (inherited) from the passed class/object. It will be like this: [Your class name]$$EnhancerByCGLIB$$[some alphanumeric] i.e. Customer$$EnhancerByCGLIB$$d8f6a6bd. If you need access original class you can use method public Class getOriginalClass();

See Also:
Serialized Form

Nested Class Summary
private  class CGLibInstantiator.DomainObjectInterceptor
           
private static class CGLibInstantiator.InnerDomainObject
           
 
Field Summary
private static java.util.Map<java.lang.String,java.lang.reflect.Method> abstractDomainObjectMethods
           
private  java.util.Set<java.lang.String> abstractDomainObjectMethodsToSkip
          Execute methods of superclass rather then AbstractDomainObject methods if they have the same names
private static java.lang.Object[] EMPTY_ARG
           
private  java.lang.reflect.Method[] instanceMethods
           
private static long serialVersionUID
           
 
Constructor Summary
CGLibInstantiator()
           
CGLibInstantiator(java.util.Set<java.lang.String> abstractDomainObjectMethodsToSkip)
           
 
Method Summary
 T enhance(T instance)
           
 java.util.Set<java.lang.String> getAbstractDomainObjectMethodsToSkip()
           
private  java.lang.reflect.Method getInstanceMethod(java.lang.String methodName)
           
private  void init()
           
 T newInstance(java.lang.Class domainClass)
           
protected  T process(java.lang.Class domainClass, T instance)
           
 void setAbstractDomainObjectMethodsToSkip(java.util.Set<java.lang.String> methodsToSkip)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

abstractDomainObjectMethods

private static java.util.Map<java.lang.String,java.lang.reflect.Method> abstractDomainObjectMethods

abstractDomainObjectMethodsToSkip

private java.util.Set<java.lang.String> abstractDomainObjectMethodsToSkip
Execute methods of superclass rather then AbstractDomainObject methods if they have the same names


EMPTY_ARG

private static final java.lang.Object[] EMPTY_ARG

instanceMethods

private java.lang.reflect.Method[] instanceMethods
Constructor Detail

CGLibInstantiator

public CGLibInstantiator()

CGLibInstantiator

public CGLibInstantiator(java.util.Set<java.lang.String> abstractDomainObjectMethodsToSkip)
Method Detail

getAbstractDomainObjectMethodsToSkip

public java.util.Set<java.lang.String> getAbstractDomainObjectMethodsToSkip()

setAbstractDomainObjectMethodsToSkip

public void setAbstractDomainObjectMethodsToSkip(java.util.Set<java.lang.String> methodsToSkip)

init

private void init()

getInstanceMethod

private java.lang.reflect.Method getInstanceMethod(java.lang.String methodName)

newInstance

public T newInstance(java.lang.Class domainClass)
Specified by:
newInstance in interface Instantiator<T>

enhance

public T enhance(T instance)
Specified by:
enhance in interface Instantiator<T>

process

protected T process(java.lang.Class domainClass,
                    T instance)