Package org.apache.commons.configuration.tree

Examples of org.apache.commons.configuration.tree.ImmutableNode


         *
         * @return the transformed root node
         */
        public ImmutableNode getTransformedRoot()
        {
            ImmutableNode configRoot = getRootNodeOfConfiguration();
            return (atPath == null) ? configRoot : prependAtPath(configRoot);
        }
View Full Code Here


        private ImmutableNode getRootNodeOfConfiguration()
        {
            getConfiguration().lock(LockMode.READ);
            try
            {
                ImmutableNode root =
                        ConfigurationUtils
                                .convertToHierarchical(getConfiguration(),
                                        conversionExpressionEngine).getNodeModel()
                                .getInMemoryRepresentation();
                rootNode = root;
View Full Code Here

        if (nodes.size() != 1)
        {
            return Collections.emptyList();
        }

        ImmutableNode parent = nodes.get(0);
        List<HierarchicalConfiguration<ImmutableNode>> subs =
                new ArrayList<HierarchicalConfiguration<ImmutableNode>>(parent
                        .getChildren().size());
        for (ImmutableNode node : parent.getChildren())
        {
            subs.add(createIndependentSubConfigurationForNode(node));
        }

        return subs;
View Full Code Here

     * @return the {@code NodeModel} for the new configuration
     */
    private static NodeModel<ImmutableNode> createNodeModel(
            HierarchicalConfiguration<ImmutableNode> c)
    {
        ImmutableNode root = (c != null) ? obtainRootNode(c) : null;
        return new InMemoryNodeModel(root);
    }
View Full Code Here

                ReferenceNodeHandler refHandler)
        {
            Collection<ImmutableNode> subNodes =
                    new LinkedList<ImmutableNode>(refHandler.getChildren(node));
            Iterator<ImmutableNode> children = subNodes.iterator();
            ImmutableNode sibling1;
            ImmutableNode nd = null;

            while (children.hasNext())
            {
                // find the next new node
                do
                {
                    sibling1 = nd;
                    nd = children.next();
                } while (refHandler.getReference(nd) != null
                        && children.hasNext());

                if (refHandler.getReference(nd) == null)
                {
                    // find all following new nodes
                    List<ImmutableNode> newNodes =
                            new LinkedList<ImmutableNode>();
                    newNodes.add(nd);
                    while (children.hasNext())
                    {
                        nd = children.next();
                        if (refHandler.getReference(nd) == null)
                        {
                            newNodes.add(nd);
                        }
                        else
                        {
                            break;
                        }
                    }

                    // Insert all new nodes
                    ImmutableNode sibling2 =
                            (refHandler.getReference(nd) == null) ? null : nd;
                    for (ImmutableNode insertNode : newNodes)
                    {
                        if (refHandler.getReference(insertNode) == null)
                        {
View Full Code Here

        public void visitAfterChildren(ImmutableNode node,
                NodeHandler<ImmutableNode> handler)
        {
            if (!isLeafNode(node, handler))
            {
                ImmutableNode newNode = pop().create();
                storeInterpolatedNode(newNode);
            }
        }
View Full Code Here

            Object value = interpolate(node.getValue());
            Map<String, Object> interpolatedAttributes =
                    new HashMap<String, Object>();
            boolean attributeChanged =
                    interpolateAttributes(node, handler, interpolatedAttributes);
            ImmutableNode newNode =
                    (valueChanged(value, handler.getValue(node)) || attributeChanged) ? new ImmutableNode.Builder()
                            .name(handler.nodeName(node)).value(value)
                            .addAttributes(interpolatedAttributes).create()
                            : node;
            storeInterpolatedNode(newNode);
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration.tree.ImmutableNode

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.