Hi,
I seriously doubt, once again, this approach. Sorry for that.
Node.getNodes() returns an Iterator with a simple, usable API and
iterating this has always been the same:
for (NodeIterator i=node.getNodes(...); i.hasNext; ) {
Node child = i.nextNode();
....
}
JCR 1.0 is not generics aware and so we should not really push it where
it does not belong ...
Regards
Felix
Jukka Zitting (JIRA) schrieb:
> [
> https://issues.apache.org/jira/browse/JCR-2120?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
> ]
>
> Jukka Zitting reopened JCR-2120:
> --------------------------------
>
> Assignee: Jukka Zitting
>
> Actually, as discussed (f2f) this morning with Thomas, what we could do is
> add a utility class in jcr-commons that does something like this:
>
> for (Node child : JcrUtils.childNodes(node)) {
> // ...
> }
>
> The childNodes() method would be implemented like this (quick draft):
>
> public static Iterable<Node> childNodes(final Node node) {
> return new Iterable<Node>() {
> public Iterator<Node> iterator() {
> return (Iterator<Node>) node.getNodes();
> }
> };
> }
>
> We could have similar methods for all the child node and property access
> methods, as well as other JCR iterators.
>
>
>
>> Make RangeIterator extend java.lang.Iterable
>> --------------------------------------------
>>
>> Key: JCR-2120
>> URL: https://issues.apache.org/jira/browse/JCR-2120
>> Project: Jackrabbit Content Repository
>> Issue Type: New Feature
>> Components: JCR API
>> Reporter: David Purpura
>> Assignee: Jukka Zitting
>>
>> Make javax.jcr.RangeIterator extend java.lang.Iterable in order to enable
>> foreach loops on implementations of RangeIterator.
>