Package com.elevenware.redcorn.beans

Examples of com.elevenware.redcorn.beans.ConstructorModel


    }

    public List<Holder> getGreedyConstructorsFrom(List<BeanDefinition> beans, List<Class<?>> allTypes) {
        List<Holder> constructors  = new ArrayList<>();
        for(BeanDefinition bean: beans) {
            ConstructorModel model = bean.getConstructorModel();
            constructors.add(new Holder(model.findBestConstructorsForTypes(allTypes, bean.getConstructorArgs()), bean));
        }
        return constructors;
    }
View Full Code Here


            @Override
            public void visit(BeanDefinition definition) {
                if(definition.isResolved()) {
                    return;
                }
               ConstructorModel model = definition.getConstructorModel();

                List<Class<?>> types = new ArrayList<>();
                Map<String, BeanDefinition> resolvedBeans = new HashMap<>();
                for(BeanDefinition dependency: existing.getBeanDefinitions()) {
                    types.add(dependency.getType());
                    resolvedBeans.put(dependency.getName(), dependency);
                }

                if(resolvedBeans.keySet().containsAll(definition.getConstructorRefs()) && !definition.getConstructorRefs().isEmpty() ) {
                    for(String ref: definition.getConstructorRefs()) {
                        definition.addContructorArg(resolvedBeans.get(ref).getPayload());
                    }
                    definition.instantiate();
                    existing.addDefinition(definition);
                    definition.markResolved();
                    return;
                }

                Constructor best = model.findBestConstructorsForTypes(types, definition.getConstructorArgs());
                if( best != null ) {

                    for(Class type: best.getParameterTypes()) {
                        List<BeanDefinition> potential = new ArrayList<>();
                        for(BeanDefinition def: existing.getBeanDefinitions()) {
View Full Code Here

TOP

Related Classes of com.elevenware.redcorn.beans.ConstructorModel

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.