Class NamedConstructorArgs


  • public class NamedConstructorArgs
    extends java.lang.Object
    NamedConstructorArgs is a BeanFactoryPostProcessor that converts property declarations into indexed constructor args based on the the constructor parameter names annotation. This process first selects a constructor and then fills in the constructor arguments from the properties defined in the bean definition. If a property is not defined in the bean definition, first the defaultValues map is checked for a value and if a value is not present a Java default value is provided for the constructor argument (e.g. numbers are assigned 0 and objects are assigned null).
    Since:
    2.0
    Version:
    $Id$
    Author:
    Dain Sundstrom
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addDefaultValue​(java.lang.String name, java.lang.Class type, java.lang.Object value)
      Adds a default value for a property with the specified name and type.
      java.util.List getDefaultValues()
      Gets the default values that are assigned to constructor arguments without a defined value.
      void processParameters​(org.springframework.beans.factory.config.BeanDefinitionHolder definitionHolder, MappingMetaData metadata)  
      void setDefaultValues​(java.util.List defaultValues)
      Sets the default values that are assigned to constructor arguments without a defined value.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NamedConstructorArgs

        public NamedConstructorArgs()
    • Method Detail

      • getDefaultValues

        public java.util.List getDefaultValues()
        Gets the default values that are assigned to constructor arguments without a defined value.
        Returns:
        the default values that are assigned to constructor arguments without a defined value
      • setDefaultValues

        public void setDefaultValues​(java.util.List defaultValues)
        Sets the default values that are assigned to constructor arguments without a defined value.
        Parameters:
        defaultValues - the values that are assigned to constructor arguments without a defined value
      • addDefaultValue

        public void addDefaultValue​(java.lang.String name,
                                    java.lang.Class type,
                                    java.lang.Object value)
        Adds a default value for a property with the specified name and type.
        Parameters:
        name - the name of the property
        type - the type of the property
        value - the default value for a property with the specified name and type
      • processParameters

        public void processParameters​(org.springframework.beans.factory.config.BeanDefinitionHolder definitionHolder,
                                      MappingMetaData metadata)
                               throws org.springframework.beans.BeansException
        Throws:
        org.springframework.beans.BeansException