Package javassist.util.proxy

Examples of javassist.util.proxy.ProxyFactory.create()


      MyCollectionHandler handler = new MyCollectionHandler(aset);
      factory.setHandler(handler);
      factory.setSuperclass(java.util.AbstractCollection.class);
      Class[] sig = {};
      Object[] args = {};
      AbstractCollection proxy = (AbstractCollection) factory.create(sig, args);
      proxy.add("Add");
      assertEquals("size", 1, aset.size());
      proxy.remove("Add");
      assertEquals("size", 0, aset.size());
      assertEquals("isEmpty", true, proxy.isEmpty());
View Full Code Here


            ProxyFactory pf = new ProxyFactory();
            pf.setInterfaces(new Class<?>[] { annotationType, Annotation.class });
            pf.setSuperclass(WebBeansAnnotation.class);
            pf.setHandler(new WebBeansAnnotation(annotationType));

            result = (WebBeansAnnotation) pf.create(new Class[] { Class.class }, new Object[] { annotationType });

        }
        catch (Exception e)
        {
            WebBeansUtil.throwRuntimeExceptions(e);
View Full Code Here

          throw new IllegalStateException("Unhandled method " + name);
        }
      }
    };
    try {
      Object newInstance = factory.create(types, args, handler);
      return (TaskInputOutputContext<?, ?, ?, ?>) newInstance;
    } catch (Exception e) {
      e.printStackTrace();
      throw new RuntimeException(e);
    }
View Full Code Here

          throw new IllegalStateException("Unhandled method " + name);
        }
      }
    };
    try {
      Object newInstance = factory.create(types, args, handler);
      return (TaskInputOutputContext<?, ?, ?, ?>) newInstance;
    } catch (Exception e) {
      e.printStackTrace();
      throw new RuntimeException(e);
    }
View Full Code Here

            ProxyFactory pf = new ProxyFactory();
            pf.setInterfaces(new Class<?>[] { annotationType, Annotation.class });
            pf.setSuperclass(WebBeansAnnotation.class);
            pf.setHandler(new WebBeansAnnotation(annotationType));

            result = (WebBeansAnnotation) pf.create(new Class[] { Class.class }, new Object[] { annotationType });

        }
        catch (Exception e)
        {
            throw new WebBeansException(e);
View Full Code Here

          }
        }
      }
    };
    try {
      Object newInstance = factory.create(types, args, handler);
      return (TaskInputOutputContext<?, ?, ?, ?>) newInstance;
    } catch (Exception e) {
      e.printStackTrace();
      throw new RuntimeException(e);
    }
View Full Code Here

                        if (neutralCCL) {
                            currentCCL = Thread.currentThread().getContextClassLoader();
                        }
                 
                        try {
                          return proxyFactory.create(c.getParameterTypes(), args, methodInterceptor);
                        }
                        catch (InvocationTargetException ite) {
                            Throwable targetException = ite.getTargetException();
                            Logger.getLogger().debug(c.getDeclaringClass().getName(), c.getName(), targetException);
                            if (targetException instanceof Exception) {
View Full Code Here

                if (neutralCCL) {
                    currentCCL = Thread.currentThread().getContextClassLoader();
                }
         
                try {
                  return proxyFactory.create(c.getParameterTypes(), args, methodInterceptor);
                }
                catch (InvocationTargetException ite) {
                    Throwable targetException = ite.getTargetException();
                    Logger.getLogger().debug(c.getDeclaringClass().getName(), c.getName(), targetException);
                    if (targetException instanceof Exception) {
View Full Code Here

    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.setSuperclass(Counters.Counter.class);
    proxyFactory.setFilter(CCMethodHandler.FILTER);
    CCMethodHandler handler = new CCMethodHandler(c);
    try {
      return (Counters.Counter) proxyFactory.create(new Class[0], new Object[0], handler);
    } catch (Exception e) {
      throw new CrunchRuntimeException(e);
    }
  }
 
View Full Code Here

          throw new IllegalStateException("Unhandled method " + name);
        }
      }
    };
    try {
      Object newInstance = factory.create(types, args, handler);
      return (TaskInputOutputContext<?, ?, ?, ?>) newInstance;
    } catch (Exception e) {
      e.printStackTrace();
      throw new RuntimeException(e);
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.