Examples of Rhinoceros


Examples of org.nutz.aop.javassist.meta.Rhinoceros

    ClassAgent aca = getNewClassAgent();
    aca.addInterceptor(MethodMatcherFactory.matcher("run"), new MethodCounter(crun));
    aca.addInterceptor(MethodMatcherFactory.matcher(".*"), new MethodCounter(cc));
    aca.addInterceptor(MethodMatcherFactory.matcher("doSomething"), new RhinocerosListener());
    Class<? extends Rhinoceros> c = aca.define(Nutzs.cd(), Rhinoceros.class);// RA.class;
    Rhinoceros r = Mirror.me(c).born();
    r.doSomething(BEH.run);
    r.doSomething(BEH.fight);
    try {
      r.doSomething(BEH.lecture);
      fail();
    }
    catch (Throwable e) {}
    try {
      r.doSomething(BEH.fly);
      fail();
    }
    catch (Throwable e) {}
//    assertEquals("[5, 3, 1, 1]", Json.toJson(cc));
    assertEquals("[1, 1, 0, 0]", Json.toJson(crun));
View Full Code Here

Examples of org.nutz.aop.javassist.meta.Rhinoceros

        ClassAgent aca = getNewClassAgent();
        aca.addInterceptor(MethodMatcherFactory.matcher("run"), new MethodCounter(crun));
        aca.addInterceptor(MethodMatcherFactory.matcher(".*"), new MethodCounter(cc));
        aca.addInterceptor(MethodMatcherFactory.matcher("doSomething"), new RhinocerosListener());
        Class<? extends Rhinoceros> c = aca.define(Nutzs.cd(), Rhinoceros.class);// RA.class;
        Rhinoceros r = Mirror.me(c).born();
        r.doSomething(BEH.run);
        r.doSomething(BEH.fight);
        try {
            r.doSomething(BEH.lecture);
            fail();
        }
        catch (Throwable e) {}
        try {
            r.doSomething(BEH.fly);
            fail();
        }
        catch (Throwable e) {}
//        assertEquals("[5, 3, 1, 1]", Json.toJson(cc));
        assertEquals("[1, 1, 0, 0]", Json.toJson(crun));
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.