/** * Wraps a proxy instance. * * <p>This method is safe in that if the object passed in is not a proxy it is simply returned. * If the proxy is not an instance of {@link ModificationProxy} it is also returned untouched. */ public static <T> T unwrap(T object) { return ProxyUtils.unwrap(object, ModificationProxy.class); }
/** * Returns the ModificationProxy invocation handler for an proxy object. * * <p>This method will return null in the case where the object is not a proxy, or it is being * proxies by another invocation handler. */ public static ModificationProxy handler(Object object) { return ProxyUtils.handler(object, ModificationProxy.class); }
/** * Wraps an object in a proxy. * * @throws RuntimeException If creating the proxy fails. */ public static <T> T create(T proxyObject, Class<T> clazz) { return ProxyUtils.createProxy(proxyObject, clazz, new ModificationProxy(proxyObject)); }
/** * Returns a wrapped {@link CatalogFacade} that will upgrade read locks to write before * attempting any write operation * * @param facade * @param configurationLock * @return */ public static CatalogFacade create( CatalogFacade facade, GeoServerConfigurationLock configurationLock) { return ProxyUtils.createProxy( facade, CatalogFacade.class, new LockingCatalogFacade(facade, configurationLock)); }
public static <T> T unwrap(T object) { return ProxyUtils.unwrap(object, NameDequalifyingProxy.class); } }
/** * Unwraps a proxy returning the underlying object, if one exists. * * <p>This method handles two cases, the first is the case of a {@link WrappingProxy} in which * the underlying proxy object is returned.. The second is the {@link ProxyList} case in which * the underlying list is returned. * * @param object The proxy object. * @param handlerClass The invocation handler class. * @return The underlying proxied object, or the object passed in if no underlying object is * recognized. */ public static <T> T unwrap(T object, Class<? extends InvocationHandler> handlerClass) { if (object instanceof Proxy) { InvocationHandler h = handler(object, handlerClass); if (h != null && h instanceof WrappingProxy) { return (T) ((WrappingProxy) h).getProxyObject(); } } if (object instanceof ProxyList) { return (T) ((ProxyList) object).proxyList; } return object; }
public static <T> T create(T object, Class<T> clazz) { return ProxyUtils.createProxy(object, clazz, new NameDequalifyingProxy(object)); }
public void syncTo(CatalogFacade dao) { dao = ProxyUtils.unwrap(dao, LockingCatalogFacade.class); if (dao instanceof DefaultCatalogFacade) {
ResolvingProxy rp = ProxyUtils.handler(result, ResolvingProxy.class);
ProxyUtils.unwrap( layerInfo, Proxy.getInvocationHandler(layerInfo).getClass());