Package javassist.util.proxy

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


    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.setSuperclass( entityContextImplType );
    proxyFactory.setFilter( new EntityOrPropertyMethodFilter() );

    try {
      return (E) proxyFactory.create(
          new Class<?>[] { ConfigurationContext.class },
          new Object[] { this },
          new EntityOrPropertyMethodHandler( entityContextImplType, propertyContextImplType ) );
    }
    catch (Exception e) {
View Full Code Here


    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.setSuperclass( propertyContextImplType );
    proxyFactory.setFilter( new EntityOrPropertyMethodFilter() );

    try {
      return (P) proxyFactory.create(
          new Class<?>[] { ConfigurationContext.class },
          new Object[] { this },
          new EntityOrPropertyMethodHandler( entityContextImplType, propertyContextImplType ) );
    }
    catch (Exception e) {
View Full Code Here

    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.setInterfaces(interfacesToProxy);

    Object instance;
    try {
      instance = proxyFactory.create(new Class[0], new Object[0], new MethodHandler() {
        @Override
        public Object invoke(Object self, Method thisMethod, Method proceed, Object[] args) throws Throwable {
          return proceed.invoke(self, args);
        }
      });
View Full Code Here

      factory.setSuperclass(rawType);
    }

    Object instance;
    try {
      instance = factory.create(null, null, new MethodInvocationAdapter<T>(handler));
    } catch (ReflectiveOperationException | IllegalArgumentException e) {
      logger.error("An error occurs when create a proxy for type " + type, e);
      throw new ProxyCreationException(e);
    }
View Full Code Here

      proxyFactory.setHandler(new InterceptorMethodHandler(target, proxyClass, getModelsFor(proxyClass), interceptionHandlerFactories));

      try
      {
         return (T) proxyFactory.create(constructorTypes, constructorArguments);
      } catch (Exception e)
      {
         throw new InterceptorException(e);
      }
   }
View Full Code Here

      factory.setSuperclass(rawType);
    }

    Object instance;
    try {
      instance = factory.create(null, null, new MethodInvocationAdapter<T>(handler));
    } catch (ReflectiveOperationException | IllegalArgumentException e) {
      logger.error("An error occurs when create a proxy for type " + type, e);
      throw new ProxyCreationException(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

                        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

/* 249 */     Object[] args = new Object[0];
/*     */
/* 251 */     SSLServerSocket proxy = null;
/*     */     try
/*     */     {
/* 254 */       proxy = (SSLServerSocket)pf.create(sig, args);
/*     */     }
/*     */     catch (Exception e)
/*     */     {
/* 258 */       IOException ioe = new IOException("Failed to create SSLServerSocket proxy");
/* 259 */       ioe.initCause(e);
View Full Code Here

    ProxyFactory proxyFactory = new ProxyFactory();
    proxyFactory.setSuperclass( globalContextImplType );
    proxyFactory.setFilter( new EntityMethodFilter() );

    try {
      return (G) proxyFactory.create(
          new Class<?>[] { ConfigurationContext.class },
          new Object[] { this },
          new EntityOrPropertyMethodHandler( entityContextImplType, propertyContextImplType ) );
    }
    catch (Exception 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.