Example usage for org.springframework.ide.eclipse.osgi.blueprint.internal ParsingUtils decorateBeanDefinitionIfRequired

List of usage examples for org.springframework.ide.eclipse.osgi.blueprint.internal ParsingUtils decorateBeanDefinitionIfRequired

Introduction

In this page you can find the example usage for org.springframework.ide.eclipse.osgi.blueprint.internal ParsingUtils decorateBeanDefinitionIfRequired.

Prototype

public static BeanDefinitionHolder decorateBeanDefinitionIfRequired(Element ele,
            BeanDefinitionHolder originalDefinition, ParserContext parserContext) 

Source Link

Usage

From source file:org.springframework.ide.eclipse.osgi.blueprint.internal.BlueprintParser.java

/**
 * Parse a value, ref or collection sub-element of a property or
 * constructor-arg element. This method is called from several places to
 * handle reusable elements such as idref, ref, null, value and so on.
 * /*from  www. j  a va  2s  . co  m*/
 * In fact, this method is the main reason why the
 * BeanDefinitionParserDelegate is not used in full since the element
 * namespace becomes important as mixed rfc124/bean content can coexist.
 * 
 * @param ele
 *            subelement of property element; we don't know which yet
 * @param defaultValueType
 *            the default type (class name) for any
 *            <code>&lt;value&gt;</code> tag that might be created
 */
private Object parsePropertySubElement(Element ele, BeanDefinition bd, String defaultValueType) {
    // skip other namespace
    String namespaceUri = ele.getNamespaceURI();

    // check Spring own namespace
    if (parserContext.getDelegate().isDefaultNamespace(namespaceUri)) {
        return parserContext.getDelegate().parsePropertySubElement(ele, bd);
    }
    // let the delegate handle other ns
    else if (!NAMESPACE_URI.equals(namespaceUri)) {
        return parserContext.getDelegate().parseCustomElement(ele);
    }

    //
    else {
        if (DomUtils.nodeNameEquals(ele, BEAN)) {
            BeanDefinitionHolder bdHolder = parseComponentDefinitionElement(ele, bd);
            if (bdHolder != null) {
                bdHolder = ParsingUtils.decorateBeanDefinitionIfRequired(ele, bdHolder, parserContext);
            }
            return bdHolder;
        }

        if (DomUtils.nodeNameEquals(ele, BeanDefinitionParserDelegate.REF_ELEMENT)) {
            return parseRefElement(ele);
        } else if (DomUtils.nodeNameEquals(ele, BeanDefinitionParserDelegate.IDREF_ELEMENT)) {
            return parseIdRefElement(ele);
        } else if (DomUtils.nodeNameEquals(ele, BeanDefinitionParserDelegate.VALUE_ELEMENT)) {
            return parseValueElement(ele, defaultValueType);
        } else if (DomUtils.nodeNameEquals(ele, BeanDefinitionParserDelegate.NULL_ELEMENT)) {
            // It's a distinguished null value. Let's wrap it in a
            // TypedStringValue
            // object in order to preserve the source location.
            TypedStringValue nullHolder = new TypedStringValue(null);
            nullHolder.setSource(parserContext.extractSource(ele));
            return nullHolder;
        } else if (DomUtils.nodeNameEquals(ele, BeanDefinitionParserDelegate.ARRAY_ELEMENT)) {
            return parseArrayElement(ele, bd);
        } else if (DomUtils.nodeNameEquals(ele, BeanDefinitionParserDelegate.LIST_ELEMENT)) {
            return parseListElement(ele, bd);
        } else if (DomUtils.nodeNameEquals(ele, BeanDefinitionParserDelegate.SET_ELEMENT)) {
            return parseSetElement(ele, bd);
        } else if (DomUtils.nodeNameEquals(ele, BeanDefinitionParserDelegate.MAP_ELEMENT)) {
            return parseMapElement(ele, bd);
        } else if (DomUtils.nodeNameEquals(ele, BeanDefinitionParserDelegate.PROPS_ELEMENT)) {
            return parsePropsElement(ele);
        }

        // maybe it's a nested service/reference/ref-list/ref-set
        return parserContext.getDelegate().parseCustomElement(ele, bd);
    }
}