Package net.hasor.core.factorys

Examples of net.hasor.core.factorys.BindInfoFactory


                    factory.setAppContext(app);
                    return factory;
                }
            };
        }
        BindInfoFactory factory = this.factoryProvider.get();
        if (factory == null) {
            throw new NullPointerException("registerFactory is null.");
        }
        return factory;
    }
View Full Code Here


    }
    /**创建Bean。*/
    public <T> T getInstance(final Class<T> targetClass) {
        Hasor.assertIsNotNull(targetClass, "targetClass is null.");
        //
        BindInfoFactory factory = this.getBindInfoFactory();
        BindInfo<T> info = factory.getBindInfo(null, targetClass);
        if (info != null) {
            Provider<T> provider = this.getProvider(info);
            if (provider != null) {
                return provider.get();
            }
        }
        return factory.getDefaultInstance(targetClass);
    };
View Full Code Here

    /*------------------------------------------------------------------------------------Binding*/
    /**通过一个类型获取所有绑定到该类型的上的对象实例。*/
    public <T> List<T> findBindingBean(final Class<T> bindType) {
        Hasor.assertIsNotNull(bindType, "bindType is null.");
        //
        BindInfoFactory infoFactory = this.getBindInfoFactory();
        String[] namesOfType = this.getBindInfoFactory().getNamesOfType(bindType);
        if (namesOfType == null || namesOfType.length == 0) {
            return new ArrayList<T>(0);
        }
        ArrayList<T> returnData = new ArrayList<T>();
        for (String name : namesOfType) {
            BindInfo<T> info = infoFactory.getBindInfo(name, bindType);
            Provider<T> provider = this.getProvider(info);
            if (provider != null) {
                T obj = provider.get();
                if (obj != null) {
                    returnData.add(obj);
View Full Code Here

    };
    /**通过一个类型获取所有绑定到该类型的上的对象实例。*/
    public <T> List<Provider<T>> findBindingProvider(final Class<T> bindType) {
        Hasor.assertIsNotNull(bindType, "bindType is null.");
        //
        BindInfoFactory infoFactory = this.getBindInfoFactory();
        String[] namesOfType = this.getBindInfoFactory().getNamesOfType(bindType);
        if (namesOfType == null || namesOfType.length == 0) {
            return new ArrayList<Provider<T>>(0);
        }
        ArrayList<Provider<T>> returnData = new ArrayList<Provider<T>>();
        for (String name : namesOfType) {
            BindInfo<T> info = infoFactory.getBindInfo(name, bindType);
            Provider<T> provider = this.getProvider(info);
            if (provider != null) {
                returnData.add(provider);
            }
        }
View Full Code Here

    };
    /**通过一个类型获取所有绑定到该类型的上的对象实例。*/
    public <T> List<BindInfo<T>> findBindingRegister(final Class<T> bindType) {
        Hasor.assertIsNotNull(bindType, "bindType is null.");
        //
        BindInfoFactory infoFactory = this.getBindInfoFactory();
        String[] namesOfType = this.getBindInfoFactory().getNamesOfType(bindType);
        if (namesOfType == null || namesOfType.length == 0) {
            return new ArrayList<BindInfo<T>>(0);
        }
        ArrayList<BindInfo<T>> returnData = new ArrayList<BindInfo<T>>();
        for (String name : namesOfType) {
            BindInfo<T> info = infoFactory.getBindInfo(name, bindType);
            if (info != null) {
                returnData.add(info);
            }
        }
        return returnData;
View Full Code Here

    };
    //
    /*------------------------------------------------------------------------------------Process*/
    /**开始进入初始化过程.*/
    protected void doInitialize() throws Throwable {
        BindInfoFactory registerFactory = this.getBindInfoFactory();
        if (registerFactory instanceof ContextInitializeListener) {
            ApiBinder apiBinder = this.newApiBinder(null);
            ((ContextInitializeListener) registerFactory).doInitialize(apiBinder);
        }
    }
View Full Code Here

            ((ContextInitializeListener) registerFactory).doInitialize(apiBinder);
        }
    }
    /**初始化过程完成.*/
    protected void doInitializeCompleted() {
        BindInfoFactory registerFactory = this.getBindInfoFactory();
        if (registerFactory instanceof ContextInitializeListener) {
            ((ContextInitializeListener) registerFactory).doInitializeCompleted(this);
        }
    }
View Full Code Here

            ((ContextInitializeListener) registerFactory).doInitializeCompleted(this);
        }
    }
    /**开始进入容器启动过程.*/
    protected void doStart() {
        BindInfoFactory registerFactory = this.getBindInfoFactory();
        if (registerFactory instanceof ContextStartListener) {
            ((ContextStartListener) registerFactory).doStart(this);
        }
    }
View Full Code Here

            ((ContextStartListener) registerFactory).doStart(this);
        }
    }
    /**容器启动完成。*/
    protected void doStartCompleted() {
        BindInfoFactory registerFactory = this.getBindInfoFactory();
        if (registerFactory instanceof ContextStartListener) {
            ((ContextStartListener) registerFactory).doStartCompleted(this);
        }
    }
View Full Code Here

TOP

Related Classes of net.hasor.core.factorys.BindInfoFactory

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.