/** * Converts a proxy object to an object that is writable to an * object stream. This method is called by <code>writeReplace()</code> * in a proxy class. * * @since 3.4 */ public static SerializedProxy makeSerializedProxy(Object proxy) throws java.io.InvalidClassException { Class clazz = proxy.getClass(); MethodHandler methodHandler = null; if (proxy instanceof ProxyObject) methodHandler = ((ProxyObject)proxy).getHandler(); else if (proxy instanceof Proxy) methodHandler = ProxyFactory.getHandler((Proxy)proxy); return new SerializedProxy(clazz, ProxyFactory.getFilterSignature(clazz), methodHandler); } }
/** * Converts a proxy object to an object that is writable to an * object stream. This method is called by <code>writeReplace()</code> * in a proxy class. * * @since 3.4 */ public static SerializedProxy makeSerializedProxy(Object proxy) throws java.io.InvalidClassException { Class<?> clazz = proxy.getClass(); MethodHandler methodHandler = null; if (proxy instanceof ProxyObject) methodHandler = ((ProxyObject)proxy).getHandler(); else if (proxy instanceof Proxy) methodHandler = ProxyFactory.getHandler((Proxy)proxy); return new SerializedProxy(clazz, ProxyFactory.getFilterSignature(clazz), methodHandler); } }
private Object[] getPyObjectArgs(Object[] args) { Object[] pyObjectArgs = new Object[args.length]; for (int index = 0; index < args.length; index++) { if (args[index] instanceof PyObjectValue) { PyObjectValueMethodHandler handler = (PyObjectValueMethodHandler) ((ProxyObject) args[index]) .getHandler(); handler.accessed = true; pyObjectArgs[index] = handler.pyObject; } else { pyObjectArgs[index] = args[index]; } } return pyObjectArgs; } }
private Object[] getPyObjectArgs(Object[] args) { Object[] pyObjectArgs = new Object[args.length]; for (int index = 0; index < args.length; index++) { if (args[index] instanceof PyObjectValue) { PyObjectValueMethodHandler handler = (PyObjectValueMethodHandler) ((ProxyObject) args[index]) .getHandler(); handler.accessed = true; pyObjectArgs[index] = handler.pyObject; } else { pyObjectArgs[index] = args[index]; } } return pyObjectArgs; } }
protected Object[] unproxyArgs(Object[] args) { if (args == null) return null; for (int i = 0; i < args.length; i++) { final Object o = args[i]; if (o instanceof ProxyObject) { final ProxyObject proxy = (ProxyObject) o; if (proxy.getHandler() instanceof RESTCollectionV1ProxyHandler) { args[i] = ((RESTCollectionV1ProxyHandler) proxy.getHandler()).getCollection(); } else if (proxy.getHandler() instanceof RESTBaseEntityV1ProxyHandler) { args[i] = ((RESTBaseEntityV1ProxyHandler) proxy.getHandler()).getEntity(); } } } return args; } }
protected Object[] unproxyArgs(Object[] args) { if (args == null) return null; for (int i = 0; i < args.length; i++) { final Object o = args[i]; if (o instanceof ProxyObject) { final ProxyObject proxy = (ProxyObject) o; if (proxy.getHandler() instanceof RESTCollectionV1ProxyHandler) { args[i] = ((RESTCollectionV1ProxyHandler) proxy.getHandler()).getCollection(); } else if (proxy.getHandler() instanceof RESTBaseEntityV1ProxyHandler) { args[i] = ((RESTBaseEntityV1ProxyHandler) proxy.getHandler()).getEntity(); } } } return args; } }
static FrozenLazyInitializer get(HibernateProxy hibernateProxy) { ProxyObject proxyObject = (ProxyObject)hibernateProxy; MethodHandler handler = proxyObject.getHandler(); if (handler instanceof FrozenLazyInitializer) { return (FrozenLazyInitializer)handler; } return new FrozenLazyInitializerImpl(hibernateProxy); } }
/** * Get the non proxied version of a REST Entity. * * @param entity The possible proxied entity. * @return The unwrapped/non-proxy entity, or the original entity if it wasn't a proxy. */ @SuppressWarnings("rawtypes") protected RESTBaseElementV1<?> getEntity(final Object entity) { if (entity instanceof ProxyObject) { final MethodHandler handler = ((ProxyObject) entity).getHandler(); if (handler instanceof RESTBaseEntityV1ProxyHandler) { return ((RESTBaseEntityV1ProxyHandler) handler).getEntity(); } } return (RESTBaseElementV1<?>) entity; }
@Override public V unwrap() { // Get the original non proxied collection final V baseCollection = getCollection(); final V collection = (baseCollection instanceof ProxyObject) ? (V) ((RESTCollectionV1ProxyHandler<?, ?, ?>) ((ProxyObject) baseCollection).getHandler()).getCollection() : baseCollection; return collection; }
/** * Converts a proxy object to an object that is writable to an * object stream. This method is called by <code>writeReplace()</code> * in a proxy class. * * @since 3.4 */ public static SerializedProxy makeSerializedProxy(Object proxy) throws java.io.InvalidClassException { Class clazz = proxy.getClass(); MethodHandler methodHandler = null; if (proxy instanceof ProxyObject) methodHandler = ((ProxyObject)proxy).getHandler(); return new SerializedProxy(clazz, ProxyFactory.getFilterSignature(clazz), methodHandler); } }
/** * Converts a proxy object to an object that is writable to an * object stream. This method is called by <code>writeReplace()</code> * in a proxy class. * * @since 3.4 */ public static SerializedProxy makeSerializedProxy(Object proxy) throws java.io.InvalidClassException { Class clazz = proxy.getClass(); MethodHandler methodHandler = null; if (proxy instanceof ProxyObject) methodHandler = ((ProxyObject)proxy).getHandler(); else if (proxy instanceof Proxy) methodHandler = ProxyFactory.getHandler((Proxy)proxy); return new SerializedProxy(clazz, ProxyFactory.getFilterSignature(clazz), methodHandler); } }
/** * Converts a proxy object to an object that is writable to an * object stream. This method is called by <code>writeReplace()</code> * in a proxy class. * * @since 3.4 */ public static SerializedProxy makeSerializedProxy(Object proxy) throws java.io.InvalidClassException { Class clazz = proxy.getClass(); MethodHandler methodHandler = null; if (proxy instanceof ProxyObject) methodHandler = ((ProxyObject)proxy).getHandler(); else if (proxy instanceof Proxy) methodHandler = ProxyFactory.getHandler((Proxy)proxy); return new SerializedProxy(clazz, ProxyFactory.getFilterSignature(clazz), methodHandler); } }
private void readObject(ObjectInputStream objectInputStream) throws IOException { try { objectInputStream.defaultReadObject(); if (isProxy() && targetInstance instanceof ProxyObject && ((ProxyObject) targetInstance).getHandler() == null) { ((ProxyObject) targetInstance).setHandler(DEFAULT_METHOD_HANDLER); } executeInterception(isProxy() ? targetInstance : null, null, null, null, InterceptionType.POST_ACTIVATE); } catch (Throwable throwable) { throw new IOException("Error while deserializing class", throwable); } }
/** * Converts a proxy object to an object that is writable to an * object stream. This method is called by <code>writeReplace()</code> * in a proxy class. * * @since 3.4 */ public static SerializedProxy makeSerializedProxy(Object proxy) throws java.io.InvalidClassException { Class clazz = proxy.getClass(); MethodHandler methodHandler = null; if (proxy instanceof ProxyObject) methodHandler = ((ProxyObject)proxy).getHandler(); else if (proxy instanceof Proxy) methodHandler = ProxyFactory.getHandler((Proxy)proxy); return new SerializedProxy(clazz, ProxyFactory.getFilterSignature(clazz), methodHandler); } }
FrozenLazyInitializerImpl(HibernateProxy owner) { ProxyObject proxyObject = (ProxyObject)owner; MethodHandler handler = proxyObject.getHandler(); if (!(handler instanceof LazyInitializer)) { Arguments.mustBeInstanceOfValue( "((" + ProxyObject.class.getName() + ")owner).getHandler()", handler, LazyInitializer.class); } LazyInitializer lazyInitializer = owner.getHibernateLazyInitializer(); if (lazyInitializer instanceof FrozenLazyInitializer) { throw new AssertionError("Internal bug"); } this.owner = owner; this.lazyInitializer = lazyInitializer; this.initTransient(); proxyObject.setHandler(this); }
args[0] = ((RESTBaseEntityV1ProxyHandler<T>) ((ProxyObject) item).getHandler()).getEntity();
@Override public void remove(T entity) { if (entity == null) return; final Object unwrappedEntity = entity.unwrap(); // Get the original non proxied collection final RESTCollectionV1<U, ?> baseCollection = getCollection(); final RESTCollectionV1<?, ?> collection = (baseCollection instanceof ProxyObject) ? ((RESTCollectionV1ProxyHandler<?, ?, ?>) ((ProxyObject) baseCollection).getHandler()).getCollection() : baseCollection; // Remove the item if it's found final List<? extends RESTCollectionItemV1> originalItems = CollectionUtilities.toArrayList(collection.getItems()); for (final RESTCollectionItemV1<?, ?> item : originalItems) { if (unwrappedEntity.equals(item.getItem())) { collection.getItems().remove(item); } } getEntities().remove(entity); } }
public RESTCSInfoNodeCollectionV1 getRESTCSNodeInfoRevisions(final RESTCSNodeV1 parent) { final Integer csNodeId = parent.getId(); final Integer csNodeRevision = ((RESTBaseEntityV1ProxyHandler<RESTCSNodeV1>) ((ProxyObject) parent).getHandler()).getEntityRevision();
public String getRESTCSNodeInheritedCondition(RESTCSNodeV1 parent) { final Integer csNodeId = parent.getId(); final Integer csNodeRevision = ((RESTBaseEntityV1ProxyHandler<RESTCSNodeV1>) ((ProxyObject) parent).getHandler()).getEntityRevision();
public RESTCategoryInTagCollectionV1 getRESTCategoryInTagRevisions(int id, Integer revision, final RESTBaseTagV1<?, ?, ?> parent) { final Integer tagId = parent.getId(); final Integer tagRevision = ((RESTBaseEntityV1ProxyHandler<RESTTagV1>) ((ProxyObject) parent).getHandler()).getEntityRevision();