Package net.test.simple.core._02_bind

Examples of net.test.simple.core._02_bind.InterfaceBindTest


        /*绑定类型*/
        apiBinder.bindType(FooBean.class);
        apiBinder.bindType(CustomAnnoFooBean.class);
        /*当类配置了MyAop注解时,该类的任意方法使用Aop拦截*/
        apiBinder.bindInterceptor(AopMatchers.annotatedWithClass(MyAop.class),//
                AopMatchers.anyMethod(), new SimpleInterceptor());
    }
View Full Code Here


class WarpAop implements Module {
    public void loadModule(ApiBinder apiBinder) throws Throwable {
        /*绑定类型*/
        apiBinder.bindType(FooBean.class);
        /*任意类任意方法*/
        apiBinder.bindInterceptor(AopMatchers.anyClass(), AopMatchers.anyMethod(), new SimpleInterceptor());
    }
View Full Code Here

        EventContext ec = appContext.getEnvironment().getEventContext();
        //
        final String EventName = "MyEvent";//事件链的终端
        final String SeedEvent = "SeedEvent";//种子事件
        //1.添加事件监听器F
        ec.addListener(EventName, new MyListener());
        ec.addListener(SeedEvent, new EventListener() {
            public void onEvent(String event, Object[] params) throws Throwable {
                AppContext app = (AppContext) params[0];
                EventContext localEC = app.getEnvironment().getEventContext();
                System.out.println("before MyEvent.");
View Full Code Here

        AppContext appContext = Hasor.createAppContext();
        EventContext ec = appContext.getEnvironment().getEventContext();
        //
        String EventName = "MyEvent";
        //1.添加事件监听器
        ec.addListener(EventName, new MyListener());
        //2.引发异步事件
        for (int i = 0; i < 10; i++)
            ec.fireAsyncEvent(EventName, i);
        //3.由于是异步事件,因此下面这条日志会在事件喷出Log之前打印
        System.out.println("before Event do sth...");
View Full Code Here

        AppContext appContext = Hasor.createAppContext();
        EventContext ec = appContext.getEnvironment().getEventContext();
        //
        String EventName = "MyEvent";
        //1.添加事件监听器
        ec.pushListener(EventName, new MyListener());
        //2.引发异步事件,虽然引发了10次事件但只有一次会被执行。
        for (int i = 0; i < 10; i++)
            ec.fireAsyncEvent(EventName, i);
        //3.由于事件引发一次是同步事件,因此下面这条日志会在事件处理完毕之后喷出
        System.out.println("before Event do sth...");
View Full Code Here

        AppContext appContext = Hasor.createAppContext();
        EventContext ec = appContext.getEnvironment().getEventContext();
        //
        String EventName = "MyEvent";
        //1.添加事件监听器
        ec.addListener(EventName, new MyListener());
        //2.引发异步事件
        for (int i = 0; i < 10; i++)
            ec.fireSyncEvent(EventName, i);
        //3.由于是同步事件,因此下面这条日志会在事件处理完毕之后喷出
        System.out.println("before Event do sth...");
View Full Code Here

        AppContext appContext = Hasor.createAppContext();
        EventContext ec = appContext.getEnvironment().getEventContext();
        //
        String EventName = "MyEvent";
        //1.添加事件监听器
        ec.pushListener(EventName, new MyListener());
        //2.引发异步事件,虽然引发了10次事件但只有一次会被执行。
        for (int i = 0; i < 10; i++)
            ec.fireSyncEvent(EventName, i);
        //3.由于事件引发一次是同步事件,因此下面这条日志会在事件处理完毕之后喷出
        System.out.println("after Event do sth...");
View Full Code Here

TOP

Related Classes of net.test.simple.core._02_bind.InterfaceBindTest

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.