Package org.springframework.beans.factory.config

Examples of org.springframework.beans.factory.config.ConstructorArgumentValues


            if (create == null) {
                if (BusWiringType.PROPERTY == type) {
                    beanDefinition.getPropertyValues()
                        .addPropertyValue("bus", inj);
                } else if (BusWiringType.CONSTRUCTOR == type) {
                    ConstructorArgumentValues constructorArgs = beanDefinition.getConstructorArgumentValues();
                    insertConstructorArg(constructorArgs, inj);
                }
            }
        }
    }
View Full Code Here


                "org.springframework.test.context.TestContext",
                createBeanDefinition(mycilaContext.attributes().get("org.springframework.test.context.TestContext"), ObjectFactoryBean.class));
    }

    private AbstractBeanDefinition createBeanDefinition(Object object, Class beanClass) {
        ConstructorArgumentValues args = new ConstructorArgumentValues();
        args.addIndexedArgumentValue(0, object);
        GenericBeanDefinition beanDef = new GenericBeanDefinition();
        beanDef.setBeanClass(beanClass);
        beanDef.setScope(Bean.Scope.SINGLETON.value());
        beanDef.setAutowireCandidate(true);
        beanDef.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_AUTODETECT);
View Full Code Here

        beanDef.setConstructorArgumentValues(args);
        return beanDef;
    }

    private AbstractBeanDefinition createBeanDefinition(AccessibleObject access, Class beanClass, Bean.Scope scope) {
        ConstructorArgumentValues args = new ConstructorArgumentValues();
        args.addIndexedArgumentValue(0, mycilaContext.introspector().instance());
        args.addIndexedArgumentValue(1, access);
        GenericBeanDefinition beanDef = new GenericBeanDefinition();
        beanDef.setBeanClass(beanClass);
        beanDef.setScope(scope.value());
        beanDef.setAutowireCandidate(true);
        beanDef.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_AUTODETECT);
View Full Code Here

        beanDef.setConstructorArgumentValues(args);
        return beanDef;
    }

    private AbstractBeanDefinition createBeanDefinition(AccessibleObject access, Class beanClass, Bean.Scope scope) {
        ConstructorArgumentValues args = new ConstructorArgumentValues();
        args.addIndexedArgumentValue(0, mycilaContext.introspector().instance());
        args.addIndexedArgumentValue(1, access);
        GenericBeanDefinition beanDef = new GenericBeanDefinition();
        beanDef.setBeanClass(beanClass);
        beanDef.setScope(scope.value());
        beanDef.setAutowireCandidate(true);
        beanDef.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_AUTODETECT);
View Full Code Here

    beandef.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_AUTODETECT);
    return beandef;
  }

  protected AbstractBeanDefinition defineInstanceHolderFactoryBean(Class<?> type, Object instance) throws Exception {
    ConstructorArgumentValues args = new ConstructorArgumentValues();
    args.addIndexedArgumentValue(0, type);
    args.addIndexedArgumentValue(1, instance);

    AbstractBeanDefinition beandef = BeanDefinitionReaderUtils.createBeanDefinition(null, InstanceHolderFactoryBean.class.getName(), getClass().getClassLoader());
    beandef.setConstructorArgumentValues(args);
    beandef.setAutowireCandidate(true);
    return beandef;
View Full Code Here

        String name = annotation.name();
        return name == null || name.length() == 0 ? member.getName() : name;
    }

    private AbstractBeanDefinition createBeanDefinition(Object object, Class beanClass) {
        ConstructorArgumentValues args = new ConstructorArgumentValues();
        args.addIndexedArgumentValue(0, object);
        GenericBeanDefinition beanDef = new GenericBeanDefinition();
        beanDef.setBeanClass(beanClass);
        beanDef.setScope(Bean.Scope.SINGLETON.value());
        beanDef.setAutowireCandidate(true);
        beanDef.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_AUTODETECT);
View Full Code Here

            if (create == null) {
                if (BusWiringType.PROPERTY == type) {
                    beanDefinition.getPropertyValues()
                        .addPropertyValue("bus", inj);
                } else if (BusWiringType.CONSTRUCTOR == type) {
                    ConstructorArgumentValues constructorArgs = beanDefinition.getConstructorArgumentValues();
                    insertConstructorArg(constructorArgs, inj);
                }
            }
        }
    }
View Full Code Here

            if (create == null) {
                if (BusWiringType.PROPERTY == type) {
                    beanDefinition.getPropertyValues()
                        .addPropertyValue("bus", inj);
                } else if (BusWiringType.CONSTRUCTOR == type) {
                    ConstructorArgumentValues constructorArgs = beanDefinition.getConstructorArgumentValues();
                    insertConstructorArg(constructorArgs, inj);
                }
            }
        }
    }
View Full Code Here

    if (constructorToUse == null) {
      // Need to resolve the constructor.
      boolean autowiring = (chosenCtors != null ||
          mbd.getResolvedAutowireMode() == RootBeanDefinition.AUTOWIRE_CONSTRUCTOR);
      ConstructorArgumentValues resolvedValues = null;

      int minNrOfArgs = 0;
      if (explicitArgs != null) {
        minNrOfArgs = explicitArgs.length;
      }
      else {
        ConstructorArgumentValues cargs = mbd.getConstructorArgumentValues();
        resolvedValues = new ConstructorArgumentValues();
        minNrOfArgs = resolveConstructorArguments(beanName, mbd, bw, cargs, resolvedValues);
      }

      // Take specified constructors, if any.
      Constructor[] candidates =
View Full Code Here

      // Need to determine the factory method...
      // Try all methods with this name to see if they match the given arguments.
      Method[] candidates = ReflectionUtils.getAllDeclaredMethods(factoryClass);
      boolean autowiring = (mbd.getResolvedAutowireMode() == RootBeanDefinition.AUTOWIRE_CONSTRUCTOR);
      int minTypeDiffWeight = Integer.MAX_VALUE;
      ConstructorArgumentValues resolvedValues = null;

      int minNrOfArgs = 0;
      if (explicitArgs != null) {
        minNrOfArgs = explicitArgs.length;
      }
      else {
        // We don't have arguments passed in programmatically, so we need to resolve the
        // arguments specified in the constructor arguments held in the bean definition.
        ConstructorArgumentValues cargs = mbd.getConstructorArgumentValues();
        resolvedValues = new ConstructorArgumentValues();
        minNrOfArgs = resolveConstructorArguments(beanName, mbd, bw, cargs, resolvedValues);
      }

      List causes = null;
View Full Code Here

TOP

Related Classes of org.springframework.beans.factory.config.ConstructorArgumentValues

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.