Package javassist.util.proxy

Examples of javassist.util.proxy.MethodFilter


public class JBPAPP9257Test extends TestCase {
    public void testGetHandler() throws Exception {
        ProxyFactory f = new ProxyFactory();
        f.setSuperclass(Foo.class);
        f.setFilter(new MethodFilter() {
            public boolean isHandled(Method m) {
                // ignore finalize()
                return !m.getName().equals("finalize");
            }
        });
View Full Code Here


    }

    public void testGetHandler2() throws Exception {
        ProxyFactory f = new ProxyFactory();
        f.setSuperclass(Foo2.class);
        f.setFilter(new MethodFilter() {
            public boolean isHandled(Method m) {
                // ignore finalize()
                return !m.getName().equals("finalize");
            }
        });
View Full Code Here

    public void testProxyFactory() throws Exception {
        ProxyFactory f = new ProxyFactory();
        f.writeDirectory = "./proxy";
        f.setSuperclass(Foo.class);
        f.setFilter(new MethodFilter() {
            public boolean isHandled(Method m) {
                return m.getName().startsWith("f");
            }
        });
        Class c = f.createClass();
View Full Code Here

            Class javaTargetClass = classPool.toClass(ctTargetClass);
            Class javaHandlerClass = classPool.toClass(ctHandlerClass);
            Class javaFilterClass = classPool.toClass(ctFilterClass);

            MethodHandler handler= (MethodHandler)javaHandlerClass.newInstance();
            MethodFilter filter = (MethodFilter)javaFilterClass.newInstance();

            // ok, now create a factory and a proxy class and proxy from that factory
            factory.setFilter(filter);
            factory.setSuperclass(javaTargetClass);
            // factory.setSuperclass(Object.class);
View Full Code Here

      types = new Class[] { Configuration.class, TaskAttemptID.class, RecordWriter.class, OutputCommitter.class,
          StatusReporter.class };
      args = new Object[] { conf, new TaskAttemptID(), null, null, null };
      factory.setSuperclass(superType);
    }
    factory.setFilter(new MethodFilter() {
      @Override
      public boolean isHandled(Method m) {
        return m.getName().equals("getConfiguration");
      }
    });
View Full Code Here

        final ProxyFactory proxyFactory = new ProxyFactory();
        proxyFactory.setSuperclass(cls);
        proxyFactory.setInterfaces(ArrayUtils.combine(cls.getInterfaces(), new Class<?>[] { JavassistEnhanced.class }));

        proxyFactory.setFilter(new MethodFilter() {
            @Override
            public boolean isHandled(final Method m) {
                // ignore finalize()
                return !m.getName().equals("finalize");
            }
View Full Code Here

                     }
                  }
                  else
                     hierarchy = Arrays.copy(types, new Class<?>[types.length]);

                  MethodFilter filter = new MethodFilter()
                  {
                     @Override
                     public boolean isHandled(Method method)
                     {
                        if (!method.getDeclaringClass().getName().contains("java.lang")
View Full Code Here

        final ProxyFactory proxyFactory = new ProxyFactory();
        proxyFactory.setSuperclass(cls);
        proxyFactory.setInterfaces(ArrayUtils.combine(cls.getInterfaces(), new Class<?>[] { JavassistEnhanced.class }));

        proxyFactory.setFilter(new MethodFilter() {
            @Override
            public boolean isHandled(final Method m) {
                // ignore finalize()
                return !m.getName().equals("finalize");
            }
View Full Code Here

    * Create a proxy for the given {@link Class} type.
    */
   @SuppressWarnings("unchecked")
   public static <T> T enhance(final ClassLoader loader, Object instance, ForgeProxy handler)
   {
      MethodFilter filter = new MethodFilter()
      {
         @Override
         public boolean isHandled(Method method)
         {
            String name = method.getName();
View Full Code Here

    * Create a proxy for the given {@link Class} type.
    */
   @SuppressWarnings("unchecked")
   public static <T> T enhance(Class<T> type, ForgeProxy handler)
   {
      MethodFilter filter = new MethodFilter()
      {
         @Override
         public boolean isHandled(Method method)
         {
            String name = method.getName();
View Full Code Here

TOP

Related Classes of javassist.util.proxy.MethodFilter

Copyright © 2018 www.massapicom. 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.