commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oliver Heger (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CONFIGURATION-664) Add API org.apache.commons.configuration2.tree.ImmutableNode.getChildren(String)
Date Tue, 25 Apr 2017 17:15:04 GMT

    [ https://issues.apache.org/jira/browse/CONFIGURATION-664?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15983270#comment-15983270
] 

Oliver Heger commented on CONFIGURATION-664:
--------------------------------------------

I have no strong opinion about the new proposed API. Just for the record, I think that the
_configurationsAt()_ method would solve your problem. The list of configurations it yields
contains hierarchical configurations that have one of the selected nodes as root nodes. Thus,
you can use the full Configuration API to access properties stored in child nodes without
having to traverse the in-memory model.

> Add API org.apache.commons.configuration2.tree.ImmutableNode.getChildren(String)
> --------------------------------------------------------------------------------
>
>                 Key: CONFIGURATION-664
>                 URL: https://issues.apache.org/jira/browse/CONFIGURATION-664
>             Project: Commons Configuration
>          Issue Type: New Feature
>            Reporter: Gary Gregory
>            Assignee: Gary Gregory
>             Fix For: 2.2
>
>
> Add API org.apache.commons.configuration2.tree.ImmutableNode.getChildren(String):
> {code:java}
>     /**
>      * Returns a list with the children of this node. This list cannot be
>      * modified.
>      * @param name the node name to find
>      *
>      * @return a list with the child nodes
>      */
>     public List<ImmutableNode> getChildren(final String name)
>     {
>         final List<ImmutableNode> list = new ArrayList<>();
>         if (name == null) {
>             return list;
>         }
>         for (final ImmutableNode node : children) 
>         {
>             if (name.equals(node.getNodeName()))
>             {
>                 list.add(node);
>             }
>         }
>         return list;
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message