Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/proxy In directory sc8-pr-cvs1:/tmp/cvs-serv14211/src/net/sf/hibernate/proxy Modified Files: CGLIBLazyInitializer.java HibernateProxy.java HibernateProxyHelper.java LazyInitializer.java SerializableProxy.java Log Message: reformatted code with beautiful, shiny, happy TABS! improved an exception Index: CGLIBLazyInitializer.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/proxy/CGLIBLazyInitializer.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** CGLIBLazyInitializer.java 1 Jan 2003 13:56:40 -0000 1.1.1.1 --- CGLIBLazyInitializer.java 4 Jan 2003 11:15:30 -0000 1.2 *************** *** 15,24 **** /** ! * */ public final class CGLIBLazyInitializer extends LazyInitializer implements MethodInterceptor { private Class[] interfaces; ! public static HibernateProxy getProxy(Class persistentClass, Class[] interfaces, Method getIdentifierMethod, Serializable id, SessionImplementor session) throws HibernateException { try { --- 15,24 ---- /** ! * */ public final class CGLIBLazyInitializer extends LazyInitializer implements MethodInterceptor { private Class[] interfaces; ! public static HibernateProxy getProxy(Class persistentClass, Class[] interfaces, Method getIdentifierMethod, Serializable id, SessionImplementor session) throws HibernateException { try { *************** *** 35,56 **** } } ! private CGLIBLazyInitializer(Class persistentClass, Class[] interfaces, Serializable id, Method getIdentifierMethod, SessionImplementor session) { super(persistentClass, id, getIdentifierMethod, session); ! this.interfaces = interfaces; } ! ! public boolean invokeSuper(Object obj, Method method, Object args[]) throws Throwable { ! return false; ! } ! ! ! public Object afterReturn(Object obj, Method method, Object args[], boolean invokedSuper, Object retValFromSuper, Throwable e) throws Throwable{ ! return invoke(method, args); ! } ! protected Object serializableProxy() { return new SerializableProxy(persistentClass, interfaces, id, getIdentifierMethod); } - } \ No newline at end of file --- 35,58 ---- } } ! private CGLIBLazyInitializer(Class persistentClass, Class[] interfaces, Serializable id, Method getIdentifierMethod, SessionImplementor session) { super(persistentClass, id, getIdentifierMethod, session); ! this.interfaces = interfaces; } ! ! public boolean invokeSuper(Object obj, Method method, Object args[]) throws Throwable { ! return false; ! } ! ! ! public Object afterReturn(Object obj, Method method, Object args[], boolean invokedSuper, Object retValFromSuper, Throwable e) throws Throwable{ ! return invoke(method, args); ! } ! protected Object serializableProxy() { return new SerializableProxy(persistentClass, interfaces, id, getIdentifierMethod); } + + } + Index: HibernateProxy.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/proxy/HibernateProxy.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** HibernateProxy.java 1 Jan 2003 13:56:41 -0000 1.1.1.1 --- HibernateProxy.java 4 Jan 2003 11:15:30 -0000 1.2 *************** *** 8,9 **** --- 8,12 ---- } + + + Index: HibernateProxyHelper.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/proxy/HibernateProxyHelper.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** HibernateProxyHelper.java 1 Jan 2003 13:56:41 -0000 1.1.1.1 --- HibernateProxyHelper.java 4 Jan 2003 11:15:30 -0000 1.2 *************** *** 15,19 **** */ public static Object unproxy(Object object, SessionImplementor session) throws SQLException, HibernateException { ! if ( object instanceof HibernateProxy ) { HibernateProxy proxy = (HibernateProxy) object; --- 15,19 ---- */ public static Object unproxy(Object object, SessionImplementor session) throws SQLException, HibernateException { ! if ( object instanceof HibernateProxy ) { HibernateProxy proxy = (HibernateProxy) object; *************** *** 31,37 **** } ! private HibernateProxyHelper() { //cant instantiate } } --- 31,40 ---- } ! private HibernateProxyHelper() { //cant instantiate } } + + + Index: LazyInitializer.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/proxy/LazyInitializer.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** LazyInitializer.java 1 Jan 2003 13:56:42 -0000 1.1.1.1 --- LazyInitializer.java 4 Jan 2003 11:15:30 -0000 1.2 *************** *** 16,23 **** /** ! * */ public abstract class LazyInitializer { ! protected Object target = null; protected Serializable id; --- 16,23 ---- /** ! * */ public abstract class LazyInitializer { ! protected Object target = null; protected Serializable id; *************** *** 26,30 **** protected Method getIdentifierMethod; protected boolean overridesEquals; ! protected LazyInitializer(Class persistentClass, Serializable id, Method getIdentifierMethod, SessionImplementor session) { this.id = id; --- 26,30 ---- protected Method getIdentifierMethod; protected boolean overridesEquals; ! protected LazyInitializer(Class persistentClass, Serializable id, Method getIdentifierMethod, SessionImplementor session) { this.id = id; *************** *** 48,52 **** } } ! private void initializeWrapExceptions() { try { --- 48,52 ---- } } ! private void initializeWrapExceptions() { try { *************** *** 60,64 **** protected abstract Object serializableProxy(); ! protected final Object invoke(Method method, Object[] args) throws Throwable { --- 60,64 ---- protected abstract Object serializableProxy(); ! protected final Object invoke(Method method, Object[] args) throws Throwable { *************** *** 70,75 **** if ( "writeReplace".equals(methodName) ) { ! if (target==null && session!=null ) target = session.getEntity( ! new Key( id, session.getFactory().getPersister(persistentClass) ) ); if (target==null) { --- 70,75 ---- if ( "writeReplace".equals(methodName) ) { ! if (target==null && session!=null ) target = session.getEntity( ! new Key( id, session.getFactory().getPersister(persistentClass) ) ); if (target==null) { *************** *** 78,82 **** } else {*/ ! return serializableProxy(); //} } --- 78,82 ---- } else {*/ ! return serializableProxy(); //} } *************** *** 101,106 **** } else if ( params==1 && !overridesEquals && "equals".equals(methodName) ) { ! // less dodgy because Hibernate forces == to be same as identifier equals ! return new Boolean( id.equals( getIdentifierMethod.invoke( args[0], null ) ) ); } --- 101,106 ---- } else if ( params==1 && !overridesEquals && "equals".equals(methodName) ) { ! // less dodgy because Hibernate forces == to be same as identifier equals ! return new Boolean( id.equals( getIdentifierMethod.invoke( args[0], null ) ) ); } *************** *** 112,116 **** throw ite.getTargetException(); } ! } --- 112,116 ---- throw ite.getTargetException(); } ! } *************** *** 155,162 **** */ public final Object getImplementation(SessionImplementor s) throws HibernateException { ! return s.getEntity( new Key( ! getIdentifier(), ! s.getFactory().getPersister( getPersistentClass() ) ! ) ); } } --- 155,165 ---- */ public final Object getImplementation(SessionImplementor s) throws HibernateException { ! return s.getEntity( new Key( ! getIdentifier(), ! s.getFactory().getPersister( getPersistentClass() ) ! ) ); } } + + + Index: SerializableProxy.java =================================================================== RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/proxy/SerializableProxy.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** SerializableProxy.java 1 Jan 2003 13:56:42 -0000 1.1.1.1 --- SerializableProxy.java 4 Jan 2003 11:15:30 -0000 1.2 *************** *** 31,38 **** try { return CGLIBLazyInitializer.getProxy( ! persistentClass, ! interfaces, (getIdentifierMethod==null) ? null : ReflectHelper.getMethod(persistentClass, getIdentifierMethod), ! id, null ); --- 31,38 ---- try { return CGLIBLazyInitializer.getProxy( ! persistentClass, ! interfaces, (getIdentifierMethod==null) ? null : ReflectHelper.getMethod(persistentClass, getIdentifierMethod), ! id, null ); *************** *** 45,46 **** --- 45,49 ---- } } + + + |