public final class CglibLazyInitializer extends Object implements LazyInitializer, net.sf.cglib.proxy.InvocationHandler
| Modifier and Type | Field and Description |
|---|---|
private boolean |
constructed
The constructed.
|
private String |
entityName
The entity name.
|
private static net.sf.cglib.proxy.CallbackFilter |
FINALIZE_FILTER
The Constant FINALIZE_FILTER.
|
protected Method |
getIdentifierMethod
The get identifier method.
|
private Object |
id
The id.
|
private boolean |
initialized
The initialized.
|
private Class<?>[] |
interfaces
The interfaces.
|
private static org.slf4j.Logger |
log
The Constant log.
|
private Object |
owner
The target.
|
private PersistenceDelegator |
persistenceDelegator
The persistenceDelegator.
|
protected Class<?> |
persistentClass
The persistent class.
|
protected Method |
setIdentifierMethod
The set identifier method.
|
private Object |
target
The target.
|
private boolean |
unwrap
The unwrap.
|
| Modifier | Constructor and Description |
|---|---|
private |
CglibLazyInitializer(String entityName,
Class<?> persistentClass,
Class<?>[] interfaces,
Object id,
Method getIdentifierMethod,
Method setIdentifierMethod,
PersistenceDelegator pd)
Instantiates a new cglib lazy initializer.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getEntityName()
Gets the entity name.
|
Object |
getIdentifier()
Retrieve the identifier value for the enity our owning proxy represents.
|
Object |
getImplementation()
Return the underlying persistent object, initializing if necessary.
|
Object |
getOwner() |
PersistenceDelegator |
getPersistenceDelegator()
Get the session to which this proxy is associated, or null if it is not
attached.
|
Class<?> |
getPersistentClass()
Get the actual class of the entity.
|
static KunderaProxy |
getProxy(String entityName,
Class<?> persistentClass,
Class<?>[] interfaces,
Method getIdentifierMethod,
Method setIdentifierMethod,
Object id,
PersistenceDelegator pd)
Gets the proxy.
|
static Class |
getProxyFactory(Class persistentClass,
Class[] interfaces)
Gets the proxy factory.
|
private static KunderaProxy |
getProxyInstance(Class factory,
CglibLazyInitializer instance)
Gets the proxy instance.
|
protected Object |
getTarget()
Getter for property 'target'.
|
void |
initialize()
Initialize.
|
Object |
invoke(Object proxy,
Method method,
Object[] args) |
boolean |
isUninitialized()
Checks if is uninitialized.
|
boolean |
isUnwrap()
Checks if is unwrap.
|
void |
setIdentifier(Object id)
Set the identifier value for the enity our owning proxy represents.
|
void |
setImplementation(Object paramObject) |
void |
setInitialized(boolean initialized) |
void |
setOwner(Object owner) |
void |
setPersistenceDelegator(PersistenceDelegator persistenceDelegator) |
void |
setUnwrap(boolean unwrap)
Sets the unwrap.
|
void |
unsetPersistenceDelegator()
Unset this initializer's reference to session.
|
private static final org.slf4j.Logger log
private String entityName
private Object id
private Object owner
private Object target
private boolean initialized
private boolean unwrap
protected Class<?> persistentClass
protected Method getIdentifierMethod
protected Method setIdentifierMethod
private Class<?>[] interfaces
private boolean constructed
private transient PersistenceDelegator persistenceDelegator
private static final net.sf.cglib.proxy.CallbackFilter FINALIZE_FILTER
private CglibLazyInitializer(String entityName, Class<?> persistentClass, Class<?>[] interfaces, Object id, Method getIdentifierMethod, Method setIdentifierMethod, PersistenceDelegator pd)
entityName - the entity namepersistentClass - the persistent classinterfaces - the interfacesid - the idgetIdentifierMethod - the get identifier methodsetIdentifierMethod - the set identifier methodpersistenceDelegator - the persistence delegatorpublic static KunderaProxy getProxy(String entityName, Class<?> persistentClass, Class<?>[] interfaces, Method getIdentifierMethod, Method setIdentifierMethod, Object id, PersistenceDelegator pd) throws javax.persistence.PersistenceException
entityName - the entity namepersistentClass - the persistent classinterfaces - the interfacesgetIdentifierMethod - the get identifier methodsetIdentifierMethod - the set identifier methodid - the idpersistenceDelegator - the persistence delegatorjavax.persistence.PersistenceException - the persistence exceptionprivate static KunderaProxy getProxyInstance(Class factory, CglibLazyInitializer instance)
factory - the factoryinstance - the instanceInstantiationException - the instantiation exceptionIllegalAccessException - the illegal access exceptionpublic static Class getProxyFactory(Class persistentClass, Class[] interfaces) throws javax.persistence.PersistenceException
persistentClass - the persistent classinterfaces - the interfacesjavax.persistence.PersistenceException - the persistence exceptionpublic Object invoke(Object proxy, Method method, Object[] args) throws Throwable
invoke in interface net.sf.cglib.proxy.InvocationHandlerThrowablepublic final Class<?> getPersistentClass()
LazyInitializerLazyInitializer.getEntityName()
should be used instead.getPersistentClass in interface LazyInitializerpublic final String getEntityName()
getEntityName in interface LazyInitializerpublic Object getIdentifier()
LazyInitializergetIdentifier in interface LazyInitializerpublic void setIdentifier(Object id)
LazyInitializersetIdentifier in interface LazyInitializerid - the id to setpublic final boolean isUninitialized()
isUninitialized in interface LazyInitializerpublic void setInitialized(boolean initialized)
setInitialized in interface LazyInitializerinitialized - the initialized to setpublic final void initialize()
throws javax.persistence.PersistenceException
initialize in interface LazyInitializerjavax.persistence.PersistenceException - the persistence exception the persistence exceptionpublic final Object getImplementation()
getImplementation in interface LazyInitializerprotected final Object getTarget()
getImplementation() except that this method will not
force initialization.public boolean isUnwrap()
isUnwrap in interface LazyInitializerpublic void setUnwrap(boolean unwrap)
setUnwrap in interface LazyInitializerunwrap - the new unwrap the new unwrappublic void setImplementation(Object paramObject)
setImplementation in interface LazyInitializerpublic PersistenceDelegator getPersistenceDelegator()
LazyInitializergetPersistenceDelegator in interface LazyInitializerpublic void setPersistenceDelegator(PersistenceDelegator persistenceDelegator)
persistenceDelegator - the persistenceDelegator to setpublic void unsetPersistenceDelegator()
LazyInitializerunsetPersistenceDelegator in interface LazyInitializerpublic void setOwner(Object owner) throws javax.persistence.PersistenceException
setOwner in interface LazyInitializerjavax.persistence.PersistenceExceptionpublic Object getOwner() throws javax.persistence.PersistenceException
getOwner in interface LazyInitializerjavax.persistence.PersistenceExceptionCopyright © 2015. All Rights Reserved.