formatting: use tabs
This commit is contained in:
parent
f5702548bb
commit
d382e70b65
|
@ -63,11 +63,11 @@ public interface ProxyFactory {
|
||||||
*/
|
*/
|
||||||
public void postInstantiate(
|
public void postInstantiate(
|
||||||
String entityName,
|
String entityName,
|
||||||
Class persistentClass,
|
Class persistentClass,
|
||||||
Set interfaces,
|
Set interfaces,
|
||||||
Method getIdentifierMethod,
|
Method getIdentifierMethod,
|
||||||
Method setIdentifierMethod,
|
Method setIdentifierMethod,
|
||||||
CompositeType componentIdType) throws HibernateException;
|
CompositeType componentIdType) throws HibernateException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new proxy instance
|
* Create a new proxy instance
|
||||||
|
|
|
@ -29,7 +29,6 @@ import java.lang.reflect.Method;
|
||||||
import org.hibernate.engine.spi.EntityKey;
|
import org.hibernate.engine.spi.EntityKey;
|
||||||
import org.hibernate.engine.spi.SessionImplementor;
|
import org.hibernate.engine.spi.SessionImplementor;
|
||||||
import org.hibernate.internal.util.MarkerObject;
|
import org.hibernate.internal.util.MarkerObject;
|
||||||
import org.hibernate.internal.util.ReflectHelper;
|
|
||||||
import org.hibernate.proxy.AbstractLazyInitializer;
|
import org.hibernate.proxy.AbstractLazyInitializer;
|
||||||
import org.hibernate.type.CompositeType;
|
import org.hibernate.type.CompositeType;
|
||||||
|
|
||||||
|
|
|
@ -48,8 +48,7 @@ import org.hibernate.type.CompositeType;
|
||||||
*/
|
*/
|
||||||
public class JavassistLazyInitializer extends BasicLazyInitializer implements MethodHandler {
|
public class JavassistLazyInitializer extends BasicLazyInitializer implements MethodHandler {
|
||||||
|
|
||||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class,
|
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, JavassistLazyInitializer.class.getName());
|
||||||
JavassistLazyInitializer.class.getName());
|
|
||||||
|
|
||||||
private static final MethodFilter FINALIZE_FILTER = new MethodFilter() {
|
private static final MethodFilter FINALIZE_FILTER = new MethodFilter() {
|
||||||
public boolean isHandled(Method m) {
|
public boolean isHandled(Method m) {
|
||||||
|
@ -63,39 +62,39 @@ public class JavassistLazyInitializer extends BasicLazyInitializer implements Me
|
||||||
|
|
||||||
private JavassistLazyInitializer(
|
private JavassistLazyInitializer(
|
||||||
final String entityName,
|
final String entityName,
|
||||||
final Class persistentClass,
|
final Class persistentClass,
|
||||||
final Class[] interfaces,
|
final Class[] interfaces,
|
||||||
final Serializable id,
|
final Serializable id,
|
||||||
final Method getIdentifierMethod,
|
final Method getIdentifierMethod,
|
||||||
final Method setIdentifierMethod,
|
final Method setIdentifierMethod,
|
||||||
final CompositeType componentIdType,
|
final CompositeType componentIdType,
|
||||||
final SessionImplementor session,
|
final SessionImplementor session,
|
||||||
final boolean overridesEquals) {
|
final boolean overridesEquals) {
|
||||||
super( entityName, persistentClass, id, getIdentifierMethod, setIdentifierMethod, componentIdType, session, overridesEquals );
|
super( entityName, persistentClass, id, getIdentifierMethod, setIdentifierMethod, componentIdType, session, overridesEquals );
|
||||||
this.interfaces = interfaces;
|
this.interfaces = interfaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HibernateProxy getProxy(
|
public static HibernateProxy getProxy(
|
||||||
final String entityName,
|
final String entityName,
|
||||||
final Class persistentClass,
|
final Class persistentClass,
|
||||||
final Class[] interfaces,
|
final Class[] interfaces,
|
||||||
final Method getIdentifierMethod,
|
final Method getIdentifierMethod,
|
||||||
final Method setIdentifierMethod,
|
final Method setIdentifierMethod,
|
||||||
CompositeType componentIdType,
|
CompositeType componentIdType,
|
||||||
final Serializable id,
|
final Serializable id,
|
||||||
final SessionImplementor session) throws HibernateException {
|
final SessionImplementor session) throws HibernateException {
|
||||||
// note: interface is assumed to already contain HibernateProxy.class
|
// note: interface is assumed to already contain HibernateProxy.class
|
||||||
try {
|
try {
|
||||||
final JavassistLazyInitializer instance = new JavassistLazyInitializer(
|
final JavassistLazyInitializer instance = new JavassistLazyInitializer(
|
||||||
entityName,
|
entityName,
|
||||||
persistentClass,
|
persistentClass,
|
||||||
interfaces,
|
interfaces,
|
||||||
id,
|
id,
|
||||||
getIdentifierMethod,
|
getIdentifierMethod,
|
||||||
setIdentifierMethod,
|
setIdentifierMethod,
|
||||||
componentIdType,
|
componentIdType,
|
||||||
session,
|
session,
|
||||||
ReflectHelper.overridesEquals(persistentClass)
|
ReflectHelper.overridesEquals(persistentClass)
|
||||||
);
|
);
|
||||||
ProxyFactory factory = new ProxyFactory();
|
ProxyFactory factory = new ProxyFactory();
|
||||||
factory.setSuperclass( interfaces.length == 1 ? persistentClass : null );
|
factory.setSuperclass( interfaces.length == 1 ? persistentClass : null );
|
||||||
|
@ -108,32 +107,32 @@ public class JavassistLazyInitializer extends BasicLazyInitializer implements Me
|
||||||
return proxy;
|
return proxy;
|
||||||
}
|
}
|
||||||
catch ( Throwable t ) {
|
catch ( Throwable t ) {
|
||||||
LOG.error(LOG.javassistEnhancementFailed(entityName), t);
|
LOG.error(LOG.javassistEnhancementFailed(entityName), t);
|
||||||
throw new HibernateException(LOG.javassistEnhancementFailed(entityName), t);
|
throw new HibernateException(LOG.javassistEnhancementFailed(entityName), t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HibernateProxy getProxy(
|
public static HibernateProxy getProxy(
|
||||||
final Class factory,
|
final Class factory,
|
||||||
final String entityName,
|
final String entityName,
|
||||||
final Class persistentClass,
|
final Class persistentClass,
|
||||||
final Class[] interfaces,
|
final Class[] interfaces,
|
||||||
final Method getIdentifierMethod,
|
final Method getIdentifierMethod,
|
||||||
final Method setIdentifierMethod,
|
final Method setIdentifierMethod,
|
||||||
final CompositeType componentIdType,
|
final CompositeType componentIdType,
|
||||||
final Serializable id,
|
final Serializable id,
|
||||||
final SessionImplementor session,
|
final SessionImplementor session,
|
||||||
final boolean classOverridesEquals) throws HibernateException {
|
final boolean classOverridesEquals) throws HibernateException {
|
||||||
|
|
||||||
final JavassistLazyInitializer instance = new JavassistLazyInitializer(
|
final JavassistLazyInitializer instance = new JavassistLazyInitializer(
|
||||||
entityName,
|
entityName,
|
||||||
persistentClass,
|
persistentClass,
|
||||||
interfaces, id,
|
interfaces, id,
|
||||||
getIdentifierMethod,
|
getIdentifierMethod,
|
||||||
setIdentifierMethod,
|
setIdentifierMethod,
|
||||||
componentIdType,
|
componentIdType,
|
||||||
session,
|
session,
|
||||||
classOverridesEquals
|
classOverridesEquals
|
||||||
);
|
);
|
||||||
|
|
||||||
final HibernateProxy proxy;
|
final HibernateProxy proxy;
|
||||||
|
@ -153,7 +152,7 @@ public class JavassistLazyInitializer extends BasicLazyInitializer implements Me
|
||||||
|
|
||||||
public static Class getProxyFactory(
|
public static Class getProxyFactory(
|
||||||
Class persistentClass,
|
Class persistentClass,
|
||||||
Class[] interfaces) throws HibernateException {
|
Class[] interfaces) throws HibernateException {
|
||||||
// note: interfaces is assumed to already contain HibernateProxy.class
|
// note: interfaces is assumed to already contain HibernateProxy.class
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -164,8 +163,8 @@ public class JavassistLazyInitializer extends BasicLazyInitializer implements Me
|
||||||
return factory.createClass();
|
return factory.createClass();
|
||||||
}
|
}
|
||||||
catch ( Throwable t ) {
|
catch ( Throwable t ) {
|
||||||
LOG.error(LOG.javassistEnhancementFailed(persistentClass.getName()), t);
|
LOG.error(LOG.javassistEnhancementFailed(persistentClass.getName()), t);
|
||||||
throw new HibernateException(LOG.javassistEnhancementFailed(persistentClass.getName()), t);
|
throw new HibernateException(LOG.javassistEnhancementFailed(persistentClass.getName()), t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,16 +219,16 @@ public class JavassistLazyInitializer extends BasicLazyInitializer implements Me
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Object serializableProxy() {
|
protected Object serializableProxy() {
|
||||||
return new SerializableProxy(
|
return new SerializableProxy(
|
||||||
getEntityName(),
|
getEntityName(),
|
||||||
persistentClass,
|
persistentClass,
|
||||||
interfaces,
|
interfaces,
|
||||||
getIdentifier(),
|
getIdentifier(),
|
||||||
( isReadOnlySettingAvailable() ? Boolean.valueOf( isReadOnly() ) : isReadOnlyBeforeAttachedToSession() ),
|
( isReadOnlySettingAvailable() ? Boolean.valueOf( isReadOnly() ) : isReadOnlyBeforeAttachedToSession() ),
|
||||||
getIdentifierMethod,
|
getIdentifierMethod,
|
||||||
setIdentifierMethod,
|
setIdentifierMethod,
|
||||||
componentIdType
|
componentIdType
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,9 +53,9 @@ public class JavassistProxyFactory implements ProxyFactory, Serializable {
|
||||||
public void postInstantiate(
|
public void postInstantiate(
|
||||||
final String entityName,
|
final String entityName,
|
||||||
final Class persistentClass,
|
final Class persistentClass,
|
||||||
final Set interfaces,
|
final Set interfaces,
|
||||||
final Method getIdentifierMethod,
|
final Method getIdentifierMethod,
|
||||||
final Method setIdentifierMethod,
|
final Method setIdentifierMethod,
|
||||||
CompositeType componentIdType) throws HibernateException {
|
CompositeType componentIdType) throws HibernateException {
|
||||||
this.entityName = entityName;
|
this.entityName = entityName;
|
||||||
this.persistentClass = persistentClass;
|
this.persistentClass = persistentClass;
|
||||||
|
@ -69,18 +69,18 @@ public class JavassistProxyFactory implements ProxyFactory, Serializable {
|
||||||
|
|
||||||
public HibernateProxy getProxy(
|
public HibernateProxy getProxy(
|
||||||
Serializable id,
|
Serializable id,
|
||||||
SessionImplementor session) throws HibernateException {
|
SessionImplementor session) throws HibernateException {
|
||||||
return JavassistLazyInitializer.getProxy(
|
return JavassistLazyInitializer.getProxy(
|
||||||
factory,
|
factory,
|
||||||
entityName,
|
entityName,
|
||||||
persistentClass,
|
persistentClass,
|
||||||
interfaces,
|
interfaces,
|
||||||
getIdentifierMethod,
|
getIdentifierMethod,
|
||||||
setIdentifierMethod,
|
setIdentifierMethod,
|
||||||
componentIdType,
|
componentIdType,
|
||||||
id,
|
id,
|
||||||
session,
|
session,
|
||||||
overridesEquals
|
overridesEquals
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue