Example usage for org.springframework.beans.factory.support BeanDefinitionBuilder addConstructorArgValue

List of usage examples for org.springframework.beans.factory.support BeanDefinitionBuilder addConstructorArgValue

Introduction

In this page you can find the example usage for org.springframework.beans.factory.support BeanDefinitionBuilder addConstructorArgValue.

Prototype

public BeanDefinitionBuilder addConstructorArgValue(@Nullable Object value) 

Source Link

Document

Add an indexed constructor arg value.

Usage

From source file:org.brekka.stillingar.spring.config.ConfigurationServiceBeanDefinitionParser.java

/**
 * @param element//from  w ww.j  a va2s  . co m
 * @param parserContext
 * @param builder
 */
protected void prepareXmlBeans(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
    // ConversionManager
    builder.addConstructorArgValue(prepareXmlBeansConversionManager());

    // Namespaces
    builder.addConstructorArgReference(this.namespacesId);
}

From source file:org.brekka.stillingar.spring.config.ConfigurationServiceBeanDefinitionParser.java

/**
 * @param element//from  w ww.  j  a v a 2  s .  c o m
 * @param parserContext
 * @param builder
 */
protected void prepareDOM(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
    // ConversionManager
    builder.addConstructorArgValue(prepareDOMConversionManager());

    // Namespaces
    builder.addConstructorArgReference(this.namespacesId);
}

From source file:de.itsvs.cwtrpc.controller.config.AutowiredRemoteServiceGroupConfigBeanDefinitionParser.java

protected BeanDefinition parseFilter(Element element, ParserContext parserContext) {
    final BeanDefinitionBuilder bdd;
    final Object type;
    final String expression;

    bdd = BeanDefinitionBuilder.rootBeanDefinition(PatternFactory.class);
    bdd.getRawBeanDefinition().setSource(parserContext.extractSource(element));
    if (parserContext.isDefaultLazyInit()) {
        bdd.setLazyInit(true);//from   w  ww  . j  av a  2s.  c  o m
    }

    if (element.hasAttribute(XmlNames.TYPE_ATTR)) {
        type = element.getAttribute(XmlNames.TYPE_ATTR);
    } else {
        type = DEFAULT_PATTERN_TYPE;
    }

    expression = element.getAttribute(XmlNames.EXPRESSION_ATTR);
    if (!StringUtils.hasText(expression)) {
        parserContext.getReaderContext().error("Filter expression must not be empty",
                parserContext.extractSource(element));
    }

    bdd.setFactoryMethod("compile");
    bdd.addConstructorArgValue(type);
    bdd.addConstructorArgValue(MatcherType.PACKAGE);
    bdd.addConstructorArgValue(expression);

    return bdd.getBeanDefinition();
}

From source file:org.brekka.stillingar.spring.config.ConfigurationServiceBeanDefinitionParser.java

/**
 * @param value//from   w w  w . ja v  a2  s  .  c o  m
 * @param baseDirectoryClass
 * @return
 */
protected AbstractBeanDefinition prepareLocation(String value, Class<?> baseDirectoryClass) {
    BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(baseDirectoryClass);
    builder.addConstructorArgValue(value);
    return builder.getBeanDefinition();
}

From source file:org.brekka.stillingar.spring.config.ConfigurationServiceBeanDefinitionParser.java

@Override
protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {

    Engine engine = determineEngine(element);

    builder.addConstructorArgValue(prepareResourceManager(element, engine, parserContext));
    builder.addConstructorArgValue("true".equals(element.getAttribute("snapshot-required")));
    builder.addConstructorArgValue(prepareDefaultConfigurationSource(element, engine));
    prepareSnapshotEventHandler(element, builder);
    builder.addPropertyValue("deltaValueInterceptor", prepareDeltaValueInterceptor(element));
    builder.getRawBeanDefinition().setDestroyMethodName("shutdown");

    // Other identifiable context beans
    prepareNamespaces(element, parserContext);
    prepareLoader(element, parserContext, engine);
    preparePlaceholderConfigurer(element, parserContext);
    preparePostProcessor(element, parserContext);
    prepareReloadMechanism(element, parserContext);
}

From source file:org.brekka.stillingar.spring.config.ConfigurationServiceBeanDefinitionParser.java

/**
 * @param element/*from w w w.j ava2 s  .c om*/
 * @param path
 * @return
 */
protected AbstractBeanDefinition prepareWebappLocation(Element element, String path) {
    BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(WebappDirectory.class);
    builder.addConstructorArgValue(path);
    return builder.getBeanDefinition();
}

From source file:org.brekka.stillingar.spring.config.ConfigurationServiceBeanDefinitionParser.java

/**
 * @param element/*from   w  w  w .ja  va 2s .  c  om*/
 * @param location
 * @return
 */
protected AbstractBeanDefinition prepareResourceLocation(Element element, String location) {
    BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(ResourceDirectory.class);
    builder.addConstructorArgValue(location);
    return builder.getBeanDefinition();
}

From source file:org.brekka.stillingar.spring.config.ConfigurationServiceBeanDefinitionParser.java

/**
 * @param defaultsPath/*from   w  w  w .j a v a 2 s  .com*/
 * @return
 */
protected AbstractBeanDefinition prepareClassPathResource(String path) {
    BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(ClassPathResource.class);
    builder.addConstructorArgValue(path);
    return builder.getBeanDefinition();
}

From source file:org.brekka.stillingar.spring.config.ConfigurationServiceBeanDefinitionParser.java

protected AbstractBeanDefinition prepareFileSystemResource(String path) {
    BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(FileSystemResource.class);
    builder.addConstructorArgValue(path);
    return builder.getBeanDefinition();
}

From source file:org.brekka.stillingar.spring.config.ConfigurationServiceBeanDefinitionParser.java

/**
 * @param element//from ww w .j a v  a  2 s .c  om
 * @return
 */
protected void prepareNamespaces(Element element, ParserContext parserContext) {
    String id = element.getAttribute("id");
    this.namespacesId = id + "-Namespaces";
    List<Element> namespaceElements = selectChildElements(element, "namespace");
    ManagedArray array = new ManagedArray(String.class.getName(), namespaceElements.size() * 2);
    for (Element namespaceElement : namespaceElements) {
        array.add(namespaceElement.getAttribute("prefix"));
        array.add(namespaceElement.getAttribute("uri"));
    }
    BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(DefaultNamespaceContext.class);
    builder.addConstructorArgValue(array);
    parserContext
            .registerBeanComponent(new BeanComponentDefinition(builder.getBeanDefinition(), this.namespacesId));
}