01: //$Id: HibernateProxyHelper.java 4453 2004-08-29 07:31:03Z oneovthafew $
02: package org.hibernate.proxy;
03:
04: /**
05: * Utility methods for working with proxies. (this class is being phased out)
06: * @author Gavin King
07: */
08: public final class HibernateProxyHelper {
09:
10: /**
11: * Get the class of an instance or the underlying class
12: * of a proxy (without initializing the proxy!). It is
13: * almost always better to use the entity name!
14: */
15: public static Class getClassWithoutInitializingProxy(Object object) {
16: if (object instanceof HibernateProxy) {
17: HibernateProxy proxy = (HibernateProxy) object;
18: LazyInitializer li = proxy.getHibernateLazyInitializer();
19: return li.getPersistentClass();
20: } else {
21: return object.getClass();
22: }
23: }
24:
25: private HibernateProxyHelper() {
26: //cant instantiate
27: }
28:
29: }
|