⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 childdefinitionparser.java

📁 提供ESB 应用mule源代码 提供ESB 应用mule源代码
💻 JAVA
字号:
/* * $Id: ChildDefinitionParser.java 10285 2008-01-11 13:58:15Z acooke $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */package org.mule.config.spring.parsers.generic;import org.mule.config.spring.parsers.AbstractChildDefinitionParser;import org.w3c.dom.Element;/** * Creates a definition parser that will construct a single child element and inject it into * the parent object (the enclosing XML element). * * The parser will set all attributes defined in the Xml as bean properties and will * process any nested elements as bean properties too, except the correct Definition parser * for the element will be looked up automatically. */public class ChildDefinitionParser extends AbstractChildDefinitionParser{    protected Class clazz;    protected String setterMethod;    /**     * The class will be inferred from the class attribute     * @param setterMethod The target method (where the child will be injected)     */    public ChildDefinitionParser(String setterMethod)    {        this(setterMethod, null, null, true);    }    /**     * @param setterMethod The target method (where the child will be injected)     * @param clazz The class created by this element/parser     */    public ChildDefinitionParser(String setterMethod, Class clazz)    {        this(setterMethod, clazz, null, null == clazz);    }    /**     * The class (which is inferred from the class attribute if null here) is checked to be     * a subclass of the constraint     * @param setterMethod The target method (where the child will be injected)     * @param clazz The class created by this element/parser (may be null)     * @param constraint Superclass of clazz (may be null)     */    public ChildDefinitionParser(String setterMethod, Class clazz, Class constraint)    {        this(setterMethod, clazz, constraint, null == clazz);    }    /**     * The class (which is inferred from the class attribute if null here) is checked to be     * a subclass of the constraint.     *     * @param setterMethod The target method (where the child will be injected)     * @param clazz The class created by this element/parser (may be null)     * @param constraint Superclass of clazz (may be null)     * @param allowClassAttribute Is class read from class attribute (if present, takes precedence over clazz)     */    public ChildDefinitionParser(String setterMethod, Class clazz, Class constraint, boolean allowClassAttribute)    {        this.clazz = clazz;        this.setterMethod = setterMethod;        setClassConstraint(constraint);        setAllowClassAttribute(allowClassAttribute);    }    protected void preProcess(Element element)    {        super.preProcess(element);        if (isAllowClassAttribute())        {           clazz = null; // reset for this element        }    }    protected Class getBeanClass(Element element)    {        return clazz;    }    public String getPropertyName(Element e)    {        return setterMethod;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -