You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "David Purpura (JIRA)" <ji...@apache.org> on 2009/05/19 19:06:45 UTC
[jira] Created: (JCR-2120) Make RangeIterator extend
java.lang.Iterable
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
Make javax.jcr.RangeIterator extend java.lang.Iterable in order to enable foreach loops on implementations of RangeIterator.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (JCR-2120) Make RangeIterator extend
java.lang.Iterable
Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-2120?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12710934#action_12710934 ]
Alexander Klimetschek commented on JCR-2120:
--------------------------------------------
You'd have to request that for a new version of the JCR API, which is defined by a JSR standards body (https://jsr-283.dev.java.net/ and http://jcp.org/en/jsr/detail?id=283 ofr JCR 2.0). This might be something for a JCR 3.0, but I don't know anything about the plans for it and if, it won't be out before 2 or 3 years from now.
> 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
>
> Make javax.jcr.RangeIterator extend java.lang.Iterable in order to enable foreach loops on implementations of RangeIterator.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Resolved: (JCR-2120) java.lang.Iterable support for
RangeIterators
Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-2120?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jukka Zitting resolved JCR-2120.
--------------------------------
Resolution: Fixed
Fix Version/s: (was: 2.0.0)
2.0-alpha2
The o.a.j.commons.JcrUtils class now contains a set of utility methods that map between RangeIterators and typed Iterables. Resolving as Fixed.
> java.lang.Iterable support for RangeIterators
> ---------------------------------------------
>
> Key: JCR-2120
> URL: https://issues.apache.org/jira/browse/JCR-2120
> Project: Jackrabbit Content Repository
> Issue Type: New Feature
> Components: jackrabbit-jcr-commons
> Reporter: David Purpura
> Assignee: Jukka Zitting
> Fix For: 2.0-alpha2
>
>
> Make javax.jcr.RangeIterator extend java.lang.Iterable in order to enable foreach loops on implementations of RangeIterator.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
Re: [jira] Reopened: (JCR-2120) Make RangeIterator extend
java.lang.Iterable
Posted by Jukka Zitting <ju...@gmail.com>.
Hi,
On Wed, May 20, 2009 at 10:48 AM, Felix Meschberger <fm...@gmail.com> wrote:
> I seriously doubt, once again, this approach. Sorry for that.
If you don't like it, don't use it.
But since there is demand for something like this and the proposed
solution requires zero changes to any of our existing code or design,
I don't see why we shouldn't do that. Adding a feature like this hurts
nobody and benefits some people, so the net result is positive.
BR,
Jukka Zitting
Re: [jira] Reopened: (JCR-2120) Make RangeIterator extend
java.lang.Iterable
Posted by Thomas Müller <th...@day.com>.
Hi,
> this has always been the same
> it depends on how familiar the reader is with static
> imports in general
Sure, it depends on how open you are to learn and use new stuff.
> The best API would be:
> for (Node child : node.getNodes())
Sure.
> and I think we get there once java.util.Iterator implements Iterable, which
> I think is planned for future Java release.
I don't believe this is going to happen in the near future, if it
happens at all. If you have a link where you read that, could you
please post it?
Regards,
Thomas
Re: [jira] Reopened: (JCR-2120) Make RangeIterator extend java.lang.Iterable
Posted by Julian Reschke <ju...@gmx.de>.
Thomas Müller wrote:
> Hi,
>
> I believe this is the right solution for now. With static import:
>
> for (Node child : childNodes(node)) { ... }
>
> This is far more readable than:
>
> for (NodeIterator it = node.getNodes(); it.hasNext();) {
> Node child = it.nextNode();
> ...
> }
I disagree here; it depends on how familiar the reader is with static
imports in general, and JCRUtils in particular. It's shorter, but
requires additional knowledge of both language and libraries in use.
> The best API would be probably:
> for (Node child : node.getNodeList())
> ...
The best API would be:
for (Node child : node.getNodes())
...
and I think we get there once java.util.Iterator implements Iterable,
which I think is planned for future Java release.
BR, Julian
Re: [jira] Reopened: (JCR-2120) Make RangeIterator extend
java.lang.Iterable
Posted by Thomas Müller <th...@day.com>.
Hi,
I believe this is the right solution for now. With static import:
for (Node child : childNodes(node)) { ... }
This is far more readable than:
for (NodeIterator it = node.getNodes(); it.hasNext();) {
Node child = it.nextNode();
...
}
The best API would be probably:
for (Node child : node.getNodeList())
Regards,
Thomas
On Wed, May 20, 2009 at 10:48 AM, Felix Meschberger <fm...@gmail.com> wrote:
> 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.
>>
>
Re: [jira] Reopened: (JCR-2120) Make RangeIterator extend java.lang.Iterable
Posted by Felix Meschberger <fm...@gmail.com>.
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.
>
[jira] Reopened: (JCR-2120) Make RangeIterator extend
java.lang.Iterable
Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
[ 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.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (JCR-2120) java.lang.Iterable support for
RangeIterators
Posted by "Jukka Zitting (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-2120?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jukka Zitting updated JCR-2120:
-------------------------------
Component/s: (was: JCR API)
jackrabbit-jcr-commons
Fix Version/s: 2.0.0
Summary: java.lang.Iterable support for RangeIterators (was: Make RangeIterator extend java.lang.Iterable)
Updated issue summary to match the scope suggested above.
> java.lang.Iterable support for RangeIterators
> ---------------------------------------------
>
> Key: JCR-2120
> URL: https://issues.apache.org/jira/browse/JCR-2120
> Project: Jackrabbit Content Repository
> Issue Type: New Feature
> Components: jackrabbit-jcr-commons
> Reporter: David Purpura
> Assignee: Jukka Zitting
> Fix For: 2.0.0
>
>
> Make javax.jcr.RangeIterator extend java.lang.Iterable in order to enable foreach loops on implementations of RangeIterator.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (JCR-2120) Make RangeIterator extend
java.lang.Iterable
Posted by "David Purpura (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-2120?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12710932#action_12710932 ]
David Purpura commented on JCR-2120:
------------------------------------
fair enough.
But, it would be nice if generics were supported, such that the following would be possible:
Node root = session.getRootNode();
for (Node n : root.getNodes()){
//actions to perform
}
or the equivalent with node properties and other range iterator based implementations
> 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
>
> Make javax.jcr.RangeIterator extend java.lang.Iterable in order to enable foreach loops on implementations of RangeIterator.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (JCR-2120) Make RangeIterator extend
java.lang.Iterable
Posted by "Tobias Bocanegra (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/JCR-2120?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tobias Bocanegra closed JCR-2120.
---------------------------------
Resolution: Won't Fix
this is not possible, because:
* we cannot change the JCR API
* it makes no sense to define an Iterator "iterable". usually collections are iterable.
> 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
>
> Make javax.jcr.RangeIterator extend java.lang.Iterable in order to enable foreach loops on implementations of RangeIterator.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.