亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? hierarchicalconfiguration.java

?? 解觖java技術中后臺無法上傳數給的情況
?? JAVA
?? 第 1 頁 / 共 3 頁
字號:
package net.myvietnam.mvncore.configuration;

/* ====================================================================
 * The Apache Software License, Version 1.1
 *
 * Copyright (c) 1999-2002 The Apache Software Foundation.  All rights
 * reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. The end-user documentation included with the redistribution, if
 *    any, must include the following acknowledgement:
 *       "This product includes software developed by the
 *        Apache Software Foundation (http://www.apache.org/)."
 *    Alternately, this acknowledgement may appear in the software itself,
 *    if and wherever such third-party acknowledgements normally appear.
 *
 * 4. The names "The Jakarta Project", "Commons", and "Apache Software
 *    Foundation" must not be used to endorse or promote products derived
 *    from this software without prior written permission. For written
 *    permission, please contact apache@apache.org.
 *
 * 5. Products derived from this software may not be called "Apache"
 *    nor may "Apache" appear in their names without prior written
 *    permission of the Apache Software Foundation.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of the Apache Software Foundation.  For more
 * information on the Apache Software Foundation, please see
 * <http://www.apache.org/>.
 */

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Stack;

import org.apache.commons.collections.SequencedHashMap;
import org.apache.commons.lang.StringUtils;

/**
 * <p>A specialized configuration class that extends its base class by the
 * ability of keeping more structure in the stored properties.</p>
 * <p>There are some sources of configuration data that cannot be stored
 * very well in a <code>BaseConfiguration</code> object because then their
 * structure is lost. This is especially true for XML documents. This class
 * can deal with such structured configuration sources by storing the
 * properties in a tree-like organization.</p>
 * <p>The internal used storage form allows for a more sophisticated access to
 * single properties. As an example consider the following XML document:</p>
 * <p><pre>
 * &lt;database&gt;
 *   &lt;tables&gt;
 *     &lt;table&gt;
 *       &lt;name&gt;users&lt;/name&gt;
 *       &lt;fields&gt;
 *         &lt;field&gt;
 *           &lt;name&gt;lid&lt;/name&gt;
 *           &lt;type&gt;long&lt;/name&gt;
 *         &lt;/field&gt;
 *         &lt;field&gt;
 *           &lt;name&gt;usrName&lt;/name&gt;
 *           &lt;type&gt;java.lang.String&lt;/type&gt;
 *         &lt;/field&gt;
 *        ...
 *       &lt;/fields&gt;
 *     &lt;/table&gt;
 *     &lt;table&gt;
 *       &lt;name&gt;documents&lt;/name&gt;
 *       &lt;fields&gt;
 *         &lt;field&gt;
 *           &lt;name&gt;docid&lt;/name&gt;
 *           &lt;type&gt;long&lt;/type&gt;
 *         &lt;/field&gt;
 *         ...
 *       &lt;/fields&gt;
 *     &lt;/table&gt;
 *     ...
 *   &lt;/tables&gt;
 * &lt;/database&gt;
 * </pre></p>
 * <p>If this document is parsed and stored in a
 * <code>HierarchicalConfiguration</code> object (which can be done by one of
 * the sub classes), there are enhanced possibilities of accessing properties.
 * The keys for querying information can contain indices that select a certain
 * element if there are multiple hits.</p>
 * <p>For instance the key <code>tables.table(0).name</code> can be used to
 * find out the name of the first table. In opposite
 * <code>tables.table.name</code> would return a collection with the names of
 * all available tables. Similarily the key
 * <code>tables.table(1).fields.field.name</code> returns a collection with the
 * names of all fields of the second table. If another index is added after the
 * <code>field</code> element, a single field can be accessed:
 * <code>tables.table(1).fields.field(0).name</code>.</p>
 * <p>There is a <code>getMaxIndex()</code> method that returns the maximum
 * allowed index that can be added to a given property key. This method can be
 * used to iterate over all values defined for a certain property.</p>
 *
 * @author <a href="mailto:oliver.heger@t-online.de">Oliver Heger</a>
 * @version $Id: HierarchicalConfiguration.java,v 1.1 2003/12/09 08:25:30 huumai Exp $
 */
public class HierarchicalConfiguration extends AbstractConfiguration
{
    /** Constant for a new dummy key.*/
    private static final String NEW_KEY = "newKey";

    /** Stores the root node of this configuration.*/
    private Node root = new Node();

    /**
     * Creates a new instance of <code>HierarchicalConfiguration</code>.
     */
    public HierarchicalConfiguration()
    {
        super();
    }

    /**
     * Creates a new instance of <code>HierarchicalConfiguration</code>
     * and initializes it with default properties.
     * @param defaults default properties to be used
     */
    public HierarchicalConfiguration(Configuration defaults)
    {
        super(defaults);
    }

    /**
     * Returns the root node of this hierarchical configuration.
     * @return the root node
     */
    public Node getRoot()
    {
        return root;
    }

    /**
     * Sets the root node of this hierarchical configuration.
     * @param node the root node
     */
    public void setRoot(Node node)
    {
        if (node == null)
        {
            throw new IllegalArgumentException("Root node must not be null!");
        } /* if */
        root = node;
    }

    /**
     * Fetches the specified property. Performs a recursive lookup in the
     * tree with the configuration properties.
     * @param key the key to be looked up
     * @return the found value
     */
    protected Object getPropertyDirect(String key)
    {
        List nodes = fetchNodeList(key);

        if (nodes.size() == 0)
        {
            return null;
        } /* if */
        else
        {
            Container cont = new Container();
            for (Iterator it = nodes.iterator(); it.hasNext();)
            {
                Node nd = (Node) it.next();
                if (nd.getValue() != null)
                {
                    cont.add(nd.getValue());
                } /* if */
            } /* for */

            if (cont.size() < 1)
            {
                return null;
            } /* if */
            else
            {
                return (cont.size() == 1) ? cont.get(0) : cont;
            } /* else */
        } /* else */
    }

    /**
     * <p>Adds the property with the specified key.</p>
     * <p>To be able to deal with the structure supported by this configuration
     * implementation the passed in key is of importance, especially the
     * indices it might contain. The following example should clearify this:
     * Suppose the actual configuration contains the following elements:</p>
     * <p><pre>
     * tables
     *    +-- table
     *            +-- name = user
     *            +-- fields
     *                    +-- field
     *                            +-- name = uid
     *                    +-- field
     *                            +-- name = firstName
     *                    ...
     *    +-- table
     *            +-- name = documents
     *            +-- fields
     *                   ...
     * </pre></p>
     * <p>In this example a database structure is defined, e.g. all fields of
     * the first table could be accessed using the key
     * <code>tables.table(0).fields.field.name</code>. If now properties are
     * to be added, it must be exactly specified at which position in the
     * hierarchy the new property is to be inserted. So to add a new field name
     * to a table it is not enough to say just</p>
     * <p><pre>
     * config.addProperty("tables.table.fields.field.name", "newField");
     * </pre></p>
     * <p>The statement given above contains some ambiguity. For instance
     * it is not clear, to which table the new field should be added. If this
     * method finds such an ambiguity, it is resolved by following the last
     * valid path. Here this would be the last table. The same is true for the
     * <code>field</code>; because there are multiple fields and no explicit
     * index is provided, a new <code>name</code> property would be
     * added to the last field - which is propably not what was desired.</p>
     * <p>To make things clear explicit indices should be provided whenever
     * possible. In the example above the exact table could be specified by
     * providing an index for the <code>table</code> element as in
     * <code>tables.table(1).fields</code>. By specifying an index it can also
     * be expressed that at a given position in the configuration tree a new
     * branch should be added. In the example above we did not want to add
     * an additional <code>name</code> element to the last field of the table,
     * but we want a complete new <code>field</code> element. This can be
     * achieved by specifying an invalid index (like -1) after the element
     * where a new branch should be created. Given this our example would run:
     * </p><p><pre>
     * config.addProperty("tables.table(1).fields.field(-1).name", "newField");
     * </pre></p>
     * <p>With this notation it is possible to add new branches everywhere.
     * We could for instance create a new <code>table</code> element by
     * specifying</p>
     * <p><pre>
     * config.addProperty("tables.table(-1).fields.field.name", "newField2");
     * </pre></p>
     * <p>(Note that because after the <code>table</code> element a new
     * branch is created indices in following elements are not relevant; the
     * branch is new so there cannot be any ambiguities.)</p>
     * @param key the key of the new property
     * @param obj the value of the new property
     */
    protected void addPropertyDirect(String key, Object obj)
    {
        ConfigurationKey.KeyIterator it = new ConfigurationKey(key).iterator();
        Node parent = fetchAddNode(it, getRoot());

        Node child = new Node(it.currentKey(true));
        child.setValue(obj);
        parent.addChild(child);
    }

    /**
     * Adds a collection of nodes at the specified position of the
     * configuration tree. This method works similar to
     * <code>addProperty()</code>, but instead of a single property a whole
     * collection of nodes can be added - and thus complete configuration
     * sub trees. E.g. with this method it is possible to add parts of
     * another <code>HierarchicalConfiguration</code> object to this object.
     * @param key the key where the nodes are to be added; can be <b>null</b>,
     * then they are added to the root node
     * @param nodes a collection with the <code>Node</code> objects to be
     * added
     */
    public void addNodes(String key, Collection nodes)
    {
        if (nodes == null || nodes.isEmpty())
        {
            return;
        } /* if */

        Node parent;
        if (StringUtils.isEmpty(key))
        {
            parent = getRoot();
        } /* if */
        else
        {
            ConfigurationKey.KeyIterator kit =
                new ConfigurationKey(key).iterator();
            parent = fetchAddNode(kit, getRoot());

            // fetchAddNode() does not really fetch the last component,
            // but one before. So we must perform an additional step.
            ConfigurationKey keyNew =
                new ConfigurationKey(kit.currentKey(true));
            keyNew.append(NEW_KEY);
            parent = fetchAddNode(keyNew.iterator(), parent);
        } /* else */

        for (Iterator it = nodes.iterator(); it.hasNext();)
        {
            parent.addChild((Node) it.next());
        } /* for */
    }

    /**
     * Checks if this configuration is empty. Empty means that there are
     * no keys with any values, though there can be some (empty) nodes.
     * @return a flag if this configuration is empty
     */
    public boolean isEmpty()
    {
        return !nodeDefined(getRoot());
    }

    /**
     * Checks if the specified key is contained in this configuration.
     * Note that for this configuration the term &quot;contained&quot; means
     * that the key has an associated value. If there is a node for this key
     * that has no value but children (either defined or undefined), this
     * method will still return <b>false</b>.
     * @param key the key to be chekced
     * @return a flag if this key is contained in this configuration
     */
    public boolean containsKey(String key)
    {
        return getPropertyDirect(key) != null;
    }

    /**
     * Removes all values of the property with the given name.
     * @param key the key of the property to be removed
     */
    public void clearProperty(String key)
    {
        List nodes = fetchNodeList(key);

        for (Iterator it = nodes.iterator(); it.hasNext();)
        {
            removeNode((Node) it.next());
        } /* for */
    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人av在线电影| 夜夜嗨av一区二区三区| 蜜桃av一区二区| 午夜精品视频一区| 天堂影院一区二区| 精品一区二区影视| 99久久亚洲一区二区三区青草| 成人av在线资源| 一本到一区二区三区| 26uuu精品一区二区在线观看| 一区二区视频在线看| 日本视频一区二区三区| 亚洲精品日韩综合观看成人91| 国产一区二区女| 久久久久久久久久美女| 蜜臀av性久久久久av蜜臀妖精| 日韩欧美一级特黄在线播放| 成人av免费在线观看| 国产在线精品免费av| 91美女片黄在线| 欧美亚日韩国产aⅴ精品中极品| 国产高清不卡一区二区| 精品国产乱码久久久久久老虎 | 亚洲成人午夜电影| 精品视频色一区| 国产一区二区在线观看视频| 国产精品二三区| 日韩视频123| 亚洲黄色片在线观看| 欧美va天堂va视频va在线| 欧美一区二区三区公司| 成人午夜激情片| 午夜精品久久久久久久99水蜜桃| 欧美大片一区二区| 91视频国产资源| 韩国女主播成人在线观看| 亚洲欧美另类图片小说| 精品电影一区二区| 日本高清免费不卡视频| 国产麻豆91精品| 久久久亚洲综合| 91在线播放网址| 韩国一区二区三区| 亚洲一区二区在线观看视频| 久久久久久日产精品| 欧美男同性恋视频网站| av一区二区三区在线| 国产资源在线一区| 日韩有码一区二区三区| 亚洲少妇屁股交4| 国产午夜精品理论片a级大结局 | 国产91精品久久久久久久网曝门| 亚洲丰满少妇videoshd| 国产精品三级在线观看| 久久综合色8888| 欧美一区二区三区爱爱| 亚洲午夜电影在线观看| 国产精品视频你懂的| 国产成人午夜电影网| 看片的网站亚洲| 午夜精品福利久久久| 国产精品美女久久久久久久久| 日韩精品一区二区三区在线播放 | 亚洲综合成人在线视频| 国产免费久久精品| 久久天堂av综合合色蜜桃网| 一区二区欧美国产| 欧美亚洲国产一区二区三区| 91麻豆国产在线观看| 不卡视频一二三四| 大桥未久av一区二区三区中文| 精品一区免费av| 久久精品国产第一区二区三区| 午夜精彩视频在线观看不卡| 日韩三级伦理片妻子的秘密按摩| 欧美日韩在线电影| 欧美婷婷六月丁香综合色| 欧美视频在线播放| 欧美在线免费播放| 精品视频在线免费观看| 色婷婷亚洲一区二区三区| 91久久精品国产91性色tv| 欧美午夜在线一二页| 欧美日韩国产一二三| 在线成人av影院| 欧美成人video| 成人黄色在线视频| 一区二区三区丝袜| 天天亚洲美女在线视频| 蜜臀国产一区二区三区在线播放| 蜜乳av一区二区三区| 激情图区综合网| 高清不卡在线观看av| 99久久精品久久久久久清纯| 一本色道亚洲精品aⅴ| 欧美午夜寂寞影院| 欧美乱妇23p| 亚洲精品一区二区三区蜜桃下载 | 美女性感视频久久| 麻豆传媒一区二区三区| 久久精品99国产精品| 国产一区二区三区免费看| 成人精品gif动图一区| 日本福利一区二区| 日韩一级片在线播放| 国产日产亚洲精品系列| 91福利国产精品| 日韩午夜激情免费电影| 国产欧美日韩综合| 亚洲精品少妇30p| 久久精品久久99精品久久| 成人性色生活片| 欧美日韩极品在线观看一区| 久久蜜桃一区二区| 欧美日韩第一区日日骚| 久久精品免视看| 亚洲中国最大av网站| 精品中文av资源站在线观看| 色综合视频在线观看| 国产大陆亚洲精品国产| 欧洲亚洲精品在线| 久久久蜜臀国产一区二区| 一区二区三区日韩在线观看| 久久99精品国产麻豆婷婷| 色综合一区二区| 欧美精品一区二区在线观看| 一区二区三区久久久| 国产精品一区免费在线观看| 久久精品一区蜜桃臀影院| 亚洲欧洲三级电影| 蜜臀av性久久久久蜜臀aⅴ四虎| 色婷婷综合在线| 国产欧美一区二区精品性| 国产精品综合二区| 日本成人在线不卡视频| 91丝袜美女网| 久久久电影一区二区三区| 日日夜夜免费精品视频| 色综合天天综合在线视频| 26uuuu精品一区二区| 天堂影院一区二区| 在线观看日韩精品| 国产精品色眯眯| 国产成人免费视频| 精品美女一区二区| 午夜精品久久久久久久| 欧美亚洲综合色| 国产精品国产三级国产aⅴ入口 | 日韩欧美专区在线| 亚洲一区二区三区不卡国产欧美| 成人动漫av在线| 国产午夜一区二区三区| 久久99精品久久久久久久久久久久| 欧美三级电影网| 亚洲精品国产视频| 91啪亚洲精品| 日韩理论电影院| av一区二区三区在线| 中文字幕一区二区三区在线观看| 国产一区二区视频在线播放| 欧美成人女星排名| 成人听书哪个软件好| 欧美日韩在线免费视频| 亚洲午夜影视影院在线观看| 色婷婷久久久亚洲一区二区三区| 国产精品久久久久影院老司| 岛国一区二区在线观看| 国产亚洲短视频| 国产xxx精品视频大全| 水野朝阳av一区二区三区| 五月婷婷综合在线| 欧美人狂配大交3d怪物一区| 爽好多水快深点欧美视频| 欧美精品99久久久**| 蜜臀91精品一区二区三区 | 99国产精品久久久久久久久久 | 日韩欧美精品在线视频| 久久精品亚洲一区二区三区浴池| 久久成人免费日本黄色| 成人免费观看av| 国产精品久久一级| 色婷婷狠狠综合| 性欧美疯狂xxxxbbbb| 欧美成人三级在线| 国产成人av一区| 亚洲欧美日韩在线播放| 欧美三电影在线| 久久精品国产精品亚洲综合| 亚洲国产成人私人影院tom| 99re这里都是精品| 亚洲6080在线| 精品美女在线观看| 亚洲午夜久久久久久久久电影院| 欧美丰满美乳xxx高潮www| 久久爱www久久做| 国产欧美日韩精品在线| 色婷婷综合久久久久中文 | 国产精品亚洲综合一区在线观看| 欧美国产在线观看| 在线观看免费成人|