Package org.springframework.beans.factory.xml

Examples of org.springframework.beans.factory.xml.BeanDefinitionParserDelegate


    public static BeanDefinitionHolder parseConfigurationPointBean(Element element, ConfigurationPoint cp,
                                                                   ParserContext parserContext,
                                                                   BeanDefinitionBuilder containingBeanBuilder) {
        assertNotNull(cp, "configurationPoint");

        BeanDefinitionParserDelegate delegate = parserContext.getDelegate();
        boolean isInnerBean = containingBeanBuilder != null;
        BeanDefinition containingBean = isInnerBean ? containingBeanBuilder.getRawBeanDefinition() : null;
        ElementSelector customSelector = ns(cp.getNamespaceUri());

        // 解析custom element。
        if (customSelector.accept(element)) {
            AbstractBeanDefinition bean = (AbstractBeanDefinition) delegate.parseCustomElement(element, containingBean);
            String beanName = trimToNull(element.getAttribute("id"));

            if (beanName == null) {
                beanName = BeanDefinitionReaderUtils.generateBeanName(bean, parserContext.getRegistry(), isInnerBean);
            }
View Full Code Here


                         containingBeanBuilder == null ? null : containingBeanBuilder.getRawBeanDefinition());
    }

    /** 解析bean element。 */
    public static Object parseBean(Element element, ParserContext parserContext, BeanDefinition containingBean) {
        BeanDefinitionParserDelegate delegate = parserContext.getDelegate();
        String refName = trimToNull(element.getAttribute("ref"));

        // 如果是ref
        if (refName != null) {
            NamedBeanReference ref = new NamedBeanReference(refName, element.getAttribute("id"));
            ref.setSource(parserContext.extractSource(element));

            return ref;
        }

        // 如果是bean
        else {
            BeanDefinitionHolder beanHolder = delegate.parseBeanDefinitionElement(element, containingBean);

            if (beanHolder != null) {
                beanHolder = delegate.decorateBeanDefinitionIfRequired(element, beanHolder, containingBean);
            }

            return beanHolder;
        }
    }
View Full Code Here

    public static BeanDefinitionHolder parseConfigurationPointBean(Element element, ConfigurationPoint cp,
                                                                   ParserContext parserContext,
                                                                   BeanDefinitionBuilder containingBeanBuilder) {
        assertNotNull(cp, "configurationPoint");

        BeanDefinitionParserDelegate delegate = parserContext.getDelegate();
        boolean isInnerBean = containingBeanBuilder != null;
        BeanDefinition containingBean = isInnerBean ? containingBeanBuilder.getRawBeanDefinition() : null;
        ElementSelector customSelector = ns(cp.getNamespaceUri());

        // ����custom element��
        if (customSelector.accept(element)) {
            AbstractBeanDefinition bean = (AbstractBeanDefinition) delegate.parseCustomElement(element, containingBean);
            String beanName = trimToNull(element.getAttribute("id"));

            if (beanName == null) {
                beanName = BeanDefinitionReaderUtils.generateBeanName(bean, parserContext.getRegistry(), isInnerBean);
            }
View Full Code Here

    /**
     * ����bean element��
     */
    public static Object parseBean(Element element, ParserContext parserContext, BeanDefinition containingBean) {
        BeanDefinitionParserDelegate delegate = parserContext.getDelegate();
        String refName = trimToNull(element.getAttribute("ref"));

        // �����ref
        if (refName != null) {
            NamedBeanReference ref = new NamedBeanReference(refName, element.getAttribute("id"));
            ref.setSource(parserContext.extractSource(element));

            return ref;
        }

        // �����bean
        else {
            BeanDefinitionHolder beanHolder = delegate.parseBeanDefinitionElement(element, containingBean);

            if (beanHolder != null) {
                beanHolder = delegate.decorateBeanDefinitionIfRequired(element, beanHolder, containingBean);
            }

            return beanHolder;
        }
    }
View Full Code Here

     * ʱ��ԭ����ͬ������̳���spring��ԭ���࣬����ȱʧ��Ĭ��ֵ�ṩ��ȷ��ֵ��
     */
    public static class DocumentReaderSkippingValidation extends DefaultBeanDefinitionDocumentReader {
        @Override
        protected BeanDefinitionParserDelegate createHelper(XmlReaderContext readerContext, Element root) {
            BeanDefinitionParserDelegate delegate = new BeanDefinitionParserDelegateSkippingValidation(readerContext);
            delegate.initDefaults(root);
            return delegate;
        }
View Full Code Here

     * 时和原来不同。本类继承了spring的原有类,但对缺失的默认值提供明确的值。
     */
    public static class DocumentReaderSkippingValidation extends DefaultBeanDefinitionDocumentReader {
        @Override
        protected BeanDefinitionParserDelegate createHelper(XmlReaderContext readerContext, Element root) {
            BeanDefinitionParserDelegate delegate = new BeanDefinitionParserDelegateSkippingValidation(readerContext);
            delegate.initDefaults(root);
            return delegate;
        }
View Full Code Here

      if (childElements != null && childElements.size() == 1) {
         Element beanElement = childElements.get(0);
         if (!"http://www.springframework.org/schema/beans".equals(beanElement.getNamespaceURI())) {
            throw new IllegalStateException("Illegal inner child element");
         }
         BeanDefinitionParserDelegate delegate = parserContext.getDelegate();
         BeanDefinitionHolder beanDefinitionHolder = delegate.parseBeanDefinitionElement(beanElement);
         beanDefinitionHolder = delegate.decorateBeanDefinitionIfRequired(beanElement, beanDefinitionHolder);
         BeanDefinition beanDefinition = beanDefinitionHolder.getBeanDefinition();
         innerComponentDefinition = new BeanComponentDefinition(beanDefinition, beanDefinitionHolder.getBeanName());
      }
      return innerComponentDefinition;
   }
View Full Code Here

        // order to propagate and preserve <beans> default-* attributes correctly,
        // keep track of the current (parent) delegate, which may be null. Create
        // the new (child) delegate with a reference to the parent for fallback purposes,
        // then ultimately reset this.delegate back to its original (parent) reference.
        // this behavior emulates a stack of delegates without actually necessitating one.
        BeanDefinitionParserDelegate parent = this.delegate;
        this.delegate = createDelegate(getReaderContext(), root, parent);
 
        preProcessXml(root);
        parseBeanDefinitions(root, this.delegate);
        postProcessXml(root);
View Full Code Here

    /**
     * {@inheritDoc}
     */
    @Override
    protected BeanDefinitionParserDelegate createDelegate(XmlReaderContext readerContext, Element root, BeanDefinitionParserDelegate parentDelegate) {
      BeanDefinitionParserDelegate delegate = new ErrorSuppressingBeanDefinitionParserDelegate(readerContext, environment);
      delegate.initDefaults(root, parentDelegate);
      return delegate;
    }
View Full Code Here

        XmlReaderContext readerContext = new XmlReaderContext((Resource) config.getAdapter(Resource.class),
            new NoOpProblemReporter(), null, null, new XmlBeanDefinitionReader(
                new DefaultBeanDefinitionRegistry()), resolver);
       
        Object parser = ReflectionUtils.invokeMethod(FIND_PARSER_FOR_ELEMENT_METHOD, handler,
            (Element) currentNode, new ParserContext(readerContext, new BeanDefinitionParserDelegate(
                readerContext)));

        if (parser != null) {
          IType type = JdtUtils.getJavaType(file.getProject(), parser.getClass().getName());
          if (type != null) {
View Full Code Here

TOP

Related Classes of org.springframework.beans.factory.xml.BeanDefinitionParserDelegate

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.