[jira] [Updated] (GROOVY-8260) Static compilation requires casting inside instanceof check

2017-07-16 Thread James Kleeh (JIRA)

 [ 
https://issues.apache.org/jira/browse/GROOVY-8260?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

James Kleeh updated GROOVY-8260:

Description: 
There are many times I find myself having to cast variables directly inside an 
{{instanceof Class}} check.

In addition, I have found a specific problem with a generic {{}} where a method in the class that returns {{T}}, Groovy believes a 
collection is being returned. This is the line in question: 
https://github.com/grails/gorm-graphql/blob/ea6887bef0ced75d9cc0d01dc7b94d4fc0520266/core/src/main/groovy/org/grails/gorm/graphql/fetcher/impl/EntityDataFetcher.groovy#L45

The goal of this issue is to have the following codebase compile without 
changes.

{{git clone -b broken_compilation https://github.com/grails/gorm-graphql}}

Attempt to compile with {{./gradlew clean classes}}

  was:
There are many times I find myself having to cast variables directly inside an 
{{instanceof Class}} check.

In addition, I have found a specific problem with a generic {{}} where a method in the class that returns {{T}}, Groovy believes a 
collection is being returned.

The goal of this issue is to have the following codebase compile without 
changes.

{{git clone -b broken_compilation https://github.com/grails/gorm-graphql}}

Attempt to compile with {{./gradlew clean classes}}


> Static compilation requires casting inside instanceof check
> ---
>
> Key: GROOVY-8260
> URL: https://issues.apache.org/jira/browse/GROOVY-8260
> Project: Groovy
>  Issue Type: Bug
>  Components: Compiler
>Affects Versions: 2.4.12
> Environment: macOS JDK 1.8
>Reporter: James Kleeh
>
> There are many times I find myself having to cast variables directly inside 
> an {{instanceof Class}} check.
> In addition, I have found a specific problem with a generic {{ SomeClass>}} where a method in the class that returns {{T}}, Groovy believes 
> a collection is being returned. This is the line in question: 
> https://github.com/grails/gorm-graphql/blob/ea6887bef0ced75d9cc0d01dc7b94d4fc0520266/core/src/main/groovy/org/grails/gorm/graphql/fetcher/impl/EntityDataFetcher.groovy#L45
> The goal of this issue is to have the following codebase compile without 
> changes.
> {{git clone -b broken_compilation https://github.com/grails/gorm-graphql}}
> Attempt to compile with {{./gradlew clean classes}}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Created] (GROOVY-8260) Static compilation requires casting inside instanceof check

2017-07-16 Thread James Kleeh (JIRA)
James Kleeh created GROOVY-8260:
---

 Summary: Static compilation requires casting inside instanceof 
check
 Key: GROOVY-8260
 URL: https://issues.apache.org/jira/browse/GROOVY-8260
 Project: Groovy
  Issue Type: Bug
  Components: Compiler
Affects Versions: 2.4.12
 Environment: macOS JDK 1.8
Reporter: James Kleeh


There are many times I find myself having to cast variables directly inside an 
`instanceof Class` check.

In addition, I have found a specific problem with a generic `` where a method in the class that returns `T`, Groovy believes a 
collection is being returned.

The goal of this issue is to have the following codebase compile without 
changes.

`git clone -b broken_compilation https://github.com/grails/gorm-graphql`

Attempt to compile with `./gradlew clean classes`



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Updated] (GROOVY-8260) Static compilation requires casting inside instanceof check

2017-07-16 Thread James Kleeh (JIRA)

 [ 
https://issues.apache.org/jira/browse/GROOVY-8260?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

James Kleeh updated GROOVY-8260:

Description: 
There are many times I find myself having to cast variables directly inside an 
{{instanceof Class}} check.

In addition, I have found a specific problem with a generic {{}} where a method in the class that returns {{T}}, Groovy believes a 
collection is being returned.

The goal of this issue is to have the following codebase compile without 
changes.

{{git clone -b broken_compilation https://github.com/grails/gorm-graphql}}

Attempt to compile with {{./gradlew clean classes}}

  was:
There are many times I find myself having to cast variables directly inside an 
`instanceof Class` check.

In addition, I have found a specific problem with a generic `` where a method in the class that returns `T`, Groovy believes a 
collection is being returned.

The goal of this issue is to have the following codebase compile without 
changes.

`git clone -b broken_compilation https://github.com/grails/gorm-graphql`

Attempt to compile with `./gradlew clean classes`


> Static compilation requires casting inside instanceof check
> ---
>
> Key: GROOVY-8260
> URL: https://issues.apache.org/jira/browse/GROOVY-8260
> Project: Groovy
>  Issue Type: Bug
>  Components: Compiler
>Affects Versions: 2.4.12
> Environment: macOS JDK 1.8
>Reporter: James Kleeh
>
> There are many times I find myself having to cast variables directly inside 
> an {{instanceof Class}} check.
> In addition, I have found a specific problem with a generic {{ SomeClass>}} where a method in the class that returns {{T}}, Groovy believes 
> a collection is being returned.
> The goal of this issue is to have the following codebase compile without 
> changes.
> {{git clone -b broken_compilation https://github.com/grails/gorm-graphql}}
> Attempt to compile with {{./gradlew clean classes}}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Comment Edited] (GROOVY-8258) Create a LINQ-like DSL

2017-07-16 Thread Paul King (JIRA)

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

Paul King edited comment on GROOVY-8258 at 7/17/17 5:54 AM:


LINQ works across collections, XML documents (when parsing) and relational 
databases using a stream-like API underneath. I'd be keen for us to work on 
stream-based versions of SQL, XML and collection processing capabilities and 
then think about the DSL sugar on top of that at a later stage. If it was 
indeed a syntactic sugar layer on top of a well thought out API (as in C#) then 
I think it would belong in the language.


was (Author: paulk):
LINQ works across collections, XML documents (when parsing) and relational 
databases using a stream-like API underneath. I'd be keen for us to work on 
stream-based versions of SQL, XML and collection processing capabilities and 
then think about the DSL sugar on top of that at a later stage.

> Create a LINQ-like DSL
> --
>
> Key: GROOVY-8258
> URL: https://issues.apache.org/jira/browse/GROOVY-8258
> Project: Groovy
>  Issue Type: Improvement
>Reporter: Daniel Sun
>
> *Pojos:*
> {code:java}
> class Category {
>String name
>List articles
> }
> class Article {
>   String name
>   Integer voteCount
>   String categoryName
> }
> {code}
> *Example1:*
> {code:java}
> linq { // return an Iterator>
> from c of categories
> join a of articles on a.categoryName == c.name // join
> where c.name == 'Groovy'
> orderBy a.voteCount desc // order by
> limit 100 offset 50 // pagination
> select { // create a map, its keys: articleName, voteNum, categoryName
> articleName = a.name
> a.voteCount 
> categoryName = c.name
> }
> }
> {code}
> *Example2:*
> {code:java}
> linq { // return an Iterator>
> from c of categories
> join a of {
> from tempA of articles
> where tempA.voteCount > 10
> select tempA
> } on a.categoryName == c.name // join
> where c.name == 'Groovy'
> orderBy a.voteCount desc // order by
> limit 100 offset 50 // pagination
> select { // create a map, its keys: articleName, voteNum, categoryName
> articleName = a.name
> a.voteCount 
> categoryName = c.name
> }
> }
> {code}
> *Example3:*
> {code:java}
> linq { // return an Iterator
> from c of categories
> from a of c.articles  // another join
> where c.name == 'Groovy'
> orderBy a.voteCount desc // order by
> select Article { // create an Article instance
> a.name
> a.voteCount 
> categoryName = c.name
> }
> }
> {code}
> *TO BE CONTINUED...*



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (GROOVY-8258) Create a LINQ-like DSL

2017-07-16 Thread Paul King (JIRA)

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

Paul King commented on GROOVY-8258:
---

LINQ works across collections, XML documents (when parsing) and relational 
databases using a stream-like API underneath. I'd be keen for us to work on 
stream-based versions of SQL, XML and collection processing capabilities and 
then think about the DSL sugar on top of that at a later stage.

> Create a LINQ-like DSL
> --
>
> Key: GROOVY-8258
> URL: https://issues.apache.org/jira/browse/GROOVY-8258
> Project: Groovy
>  Issue Type: Improvement
>Reporter: Daniel Sun
>
> *Pojos:*
> {code:java}
> class Category {
>String name
>List articles
> }
> class Article {
>   String name
>   Integer voteCount
>   String categoryName
> }
> {code}
> *Example1:*
> {code:java}
> linq { // return an Iterator>
> from c of categories
> join a of articles on a.categoryName == c.name // join
> where c.name == 'Groovy'
> orderBy a.voteCount desc // order by
> limit 100 offset 50 // pagination
> select { // create a map, its keys: articleName, voteNum, categoryName
> articleName = a.name
> a.voteCount 
> categoryName = c.name
> }
> }
> {code}
> *Example2:*
> {code:java}
> linq { // return an Iterator>
> from c of categories
> join a of {
> from tempA of articles
> where tempA.voteCount > 10
> select tempA
> } on a.categoryName == c.name // join
> where c.name == 'Groovy'
> orderBy a.voteCount desc // order by
> limit 100 offset 50 // pagination
> select { // create a map, its keys: articleName, voteNum, categoryName
> articleName = a.name
> a.voteCount 
> categoryName = c.name
> }
> }
> {code}
> *Example3:*
> {code:java}
> linq { // return an Iterator
> from c of categories
> from a of c.articles  // another join
> where c.name == 'Groovy'
> orderBy a.voteCount desc // order by
> select Article { // create an Article instance
> a.name
> a.voteCount 
> categoryName = c.name
> }
> }
> {code}
> *TO BE CONTINUED...*



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (GROOVY-8258) Create a LINQ-like DSL

2017-07-16 Thread Daniel Sun (JIRA)

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

Daniel Sun commented on GROOVY-8258:


LINQ is a part of C#, so I think LINQ-like DSL should also be a part of Groovy 
:D

> Create a LINQ-like DSL
> --
>
> Key: GROOVY-8258
> URL: https://issues.apache.org/jira/browse/GROOVY-8258
> Project: Groovy
>  Issue Type: Improvement
>Reporter: Daniel Sun
>
> *Pojos:*
> {code:java}
> class Category {
>String name
>List articles
> }
> class Article {
>   String name
>   Integer voteCount
>   String categoryName
> }
> {code}
> *Example1:*
> {code:java}
> linq { // return an Iterator>
> from c of categories
> join a of articles on a.categoryName == c.name // join
> where c.name == 'Groovy'
> orderBy a.voteCount desc // order by
> limit 100 offset 50 // pagination
> select { // create a map, its keys: articleName, voteNum, categoryName
> articleName = a.name
> a.voteCount 
> categoryName = c.name
> }
> }
> {code}
> *Example2:*
> {code:java}
> linq { // return an Iterator>
> from c of categories
> join a of {
> from tempA of articles
> where tempA.voteCount > 10
> select tempA
> } on a.categoryName == c.name // join
> where c.name == 'Groovy'
> orderBy a.voteCount desc // order by
> limit 100 offset 50 // pagination
> select { // create a map, its keys: articleName, voteNum, categoryName
> articleName = a.name
> a.voteCount 
> categoryName = c.name
> }
> }
> {code}
> *Example3:*
> {code:java}
> linq { // return an Iterator
> from c of categories
> from a of c.articles  // another join
> where c.name == 'Groovy'
> orderBy a.voteCount desc // order by
> select Article { // create an Article instance
> a.name
> a.voteCount 
> categoryName = c.name
> }
> }
> {code}
> *TO BE CONTINUED...*



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[GitHub] groovy pull request #575: cache GroovyRunnerRegistry values

2017-07-16 Thread jwagenleitner
GitHub user jwagenleitner opened a pull request:

https://github.com/apache/groovy/pull/575

cache GroovyRunnerRegistry values

The registry should be read heavy and most use made of the iterator.  Few 
writes/loads should occur, so values should be cached in order to optimize 
iteration.

Benchmarked the change against using a read lock but `volatile` was 
significantly faster.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/jwagenleitner/groovy runner-values

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/groovy/pull/575.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #575


commit 28576c8da816a970d3a1151744f6b073f374e9a4
Author: John Wagenleitner 
Date:   2017-07-15T14:00:29Z

cache GroovyRunnerRegistry values

The registry should be read heavy and most use made of the
iterator.  Few writes/loads should occur, so values should
be cached in order to optimize iteration.

commit 43b26fd640a1867c557681d4381113a974cce680
Author: John Wagenleitner 
Date:   2017-07-17T01:33:20Z

GroovyRunnerRegistry iterator benchmarks




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Resolved] (GROOVY-8218) Allow to specify reverse order for @Sortable

2017-07-16 Thread John Wagenleitner (JIRA)

 [ 
https://issues.apache.org/jira/browse/GROOVY-8218?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

John Wagenleitner resolved GROOVY-8218.
---
   Resolution: Fixed
 Assignee: John Wagenleitner
Fix Version/s: 2.5.0-beta-2

Thanks for the improvement suggestion and PR.

> Allow to specify reverse order for @Sortable
> 
>
> Key: GROOVY-8218
> URL: https://issues.apache.org/jira/browse/GROOVY-8218
> Project: Groovy
>  Issue Type: Improvement
>Reporter: Paul-Julien Vauthier
>Assignee: John Wagenleitner
>Priority: Minor
> Fix For: 2.5.0-beta-2
>
>
> When using the Sortable annotation it is not possible to use reverse order. 
> For a leaderboard, you may want to sort its entries by points. 
> {code}
> @Sortable(reversed = true)
> class LeaderBoardEntry {
>   int points
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (GROOVY-8218) Allow to specify reverse order for @Sortable

2017-07-16 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on GROOVY-8218:


Github user asfgit closed the pull request at:

https://github.com/apache/groovy/pull/558


> Allow to specify reverse order for @Sortable
> 
>
> Key: GROOVY-8218
> URL: https://issues.apache.org/jira/browse/GROOVY-8218
> Project: Groovy
>  Issue Type: Improvement
>Reporter: Paul-Julien Vauthier
>Priority: Minor
>
> When using the Sortable annotation it is not possible to use reverse order. 
> For a leaderboard, you may want to sort its entries by points. 
> {code}
> @Sortable(reversed = true)
> class LeaderBoardEntry {
>   int points
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[GitHub] groovy pull request #558: GROOVY-8218 @Sortable allows reversed natural orde...

2017-07-16 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/groovy/pull/558


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] groovy pull request #573: add JMH to performance subproject

2017-07-16 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/groovy/pull/573


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (GROOVY-8258) Create a LINQ-like DSL

2017-07-16 Thread John Wagenleitner (JIRA)

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

John Wagenleitner commented on GROOVY-8258:
---

The DSL looks like it could be useful in certain situations.  But my opinion is 
that something like this would be best provided as an external library and not 
included (from the start anyway) as part of Groovy itself or one of its 
subprojects.

> Create a LINQ-like DSL
> --
>
> Key: GROOVY-8258
> URL: https://issues.apache.org/jira/browse/GROOVY-8258
> Project: Groovy
>  Issue Type: Improvement
>Reporter: Daniel Sun
>
> *Pojos:*
> {code:java}
> class Category {
>String name
>List articles
> }
> class Article {
>   String name
>   Integer voteCount
>   String categoryName
> }
> {code}
> *Example1:*
> {code:java}
> linq { // return an Iterator>
> from c of categories
> join a of articles on a.categoryName == c.name // join
> where c.name == 'Groovy'
> orderBy a.voteCount desc // order by
> limit 100 offset 50 // pagination
> select { // create a map, its keys: articleName, voteNum, categoryName
> articleName = a.name
> a.voteCount 
> categoryName = c.name
> }
> }
> {code}
> *Example2:*
> {code:java}
> linq { // return an Iterator>
> from c of categories
> join a of {
> from tempA of articles
> where tempA.voteCount > 10
> select tempA
> } on a.categoryName == c.name // join
> where c.name == 'Groovy'
> orderBy a.voteCount desc // order by
> limit 100 offset 50 // pagination
> select { // create a map, its keys: articleName, voteNum, categoryName
> articleName = a.name
> a.voteCount 
> categoryName = c.name
> }
> }
> {code}
> *Example3:*
> {code:java}
> linq { // return an Iterator
> from c of categories
> from a of c.articles  // another join
> where c.name == 'Groovy'
> orderBy a.voteCount desc // order by
> select Article { // create an Article instance
> a.name
> a.voteCount 
> categoryName = c.name
> }
> }
> {code}
> *TO BE CONTINUED...*



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (GROOVY-7572) Add withAutoClosable method

2017-07-16 Thread John Wagenleitner (JIRA)

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

John Wagenleitner commented on GROOVY-7572:
---

Just noting here that GROOVY-8251 is proposing that the method be renamed to 
{{withCloseable}} to be consistent with the existing 
{{withCloseable(java.io.Closeable...)}} method that exists in 
{{IOGroovyMethods}}.  See [PR 572|https://github.com/apache/groovy/pull/572].

> Add withAutoClosable method
> ---
>
> Key: GROOVY-7572
> URL: https://issues.apache.org/jira/browse/GROOVY-7572
> Project: Groovy
>  Issue Type: Improvement
>Reporter: Pascal Schumacher
>Assignee: Pascal Schumacher
> Fix For: 2.5.0-alpha-1
>
>
> see pull request submitted by Dominik Przybysz for details: 
> [https://github.com/apache/incubator-groovy/pull/103]



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Created] (GROOVY-8259) add suppressed exceptions for with[Auto]Closeable methods

2017-07-16 Thread John Wagenleitner (JIRA)
John Wagenleitner created GROOVY-8259:
-

 Summary: add suppressed exceptions for with[Auto]Closeable methods
 Key: GROOVY-8259
 URL: https://issues.apache.org/jira/browse/GROOVY-8259
 Project: Groovy
  Issue Type: Improvement
  Components: groovy-runtime
Affects Versions: 2.5.0-beta-1
Reporter: John Wagenleitner
Assignee: John Wagenleitner
Priority: Minor


As with the try-with-resources statement, if multiple exceptions are thrown the 
exception from the closure should be returned and the exception from closing 
should be added as a suppressed exception.

Currently the withCloseable/withAutoCloseable method return the closure 
exception and log a warning if an exception is thrown on the call to 
{{close()}}.  With this improvement the exception from {{close()}} would also 
be added as a suppressed exception to the exception thrown from the closure.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Updated] (GROOVY-8258) Create a LINQ-like DSL

2017-07-16 Thread Daniel Sun (JIRA)

 [ 
https://issues.apache.org/jira/browse/GROOVY-8258?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Sun updated GROOVY-8258:
---
Description: 
*Pojos:*
{code:java}
class Category {
   String name
   List articles
}

class Article {
  String name
  Integer voteCount
  String categoryName
}
{code}


*Example1:*
{code:java}
linq { // return an Iterator>
from c of categories
join a of articles on a.categoryName == c.name // join
where c.name == 'Groovy'
orderBy a.voteCount desc // order by
limit 100 offset 50 // pagination
select { // create a map, its keys: articleName, voteNum, categoryName
articleName = a.name
a.voteCount 
categoryName = c.name
}
}
{code}

*Example2:*
{code:java}
linq { // return an Iterator>
from c of categories
join a of {
from tempA of articles
where tempA.voteCount > 10
select tempA
} on a.categoryName == c.name // join
where c.name == 'Groovy'
orderBy a.voteCount desc // order by
limit 100 offset 50 // pagination
select { // create a map, its keys: articleName, voteNum, categoryName
articleName = a.name
a.voteCount 
categoryName = c.name
}
}
{code}

*Example3:*
{code:java}
linq { // return an Iterator
from c of categories
from a of c.articles  // another join
where c.name == 'Groovy'
orderBy a.voteCount desc // order by
select Article { // create an Article instance
a.name
a.voteCount 
categoryName = c.name
}
}
{code}

*TO BE CONTINUED...*


  was:
*Pojos:*
{code:java}
class Category {
   String name
   List articles
}

class Article {
  String name
  Integer voteCount
  String categoryName
}
{code}


*Example1:*
{code:java}
linq { // return an Iterator>
from c of categories
join a of articles on a.categoryName == c.name // join
where c.name == 'Groovy'
orderBy a.voteCount desc // order by
limit 100 offset 50 // pagination
select { // create a map, its keys: articleName, voteNum, categoryName
articleName = a.name
a.voteCount 
categoryName = c.name
}
}
{code}

*Example2:*
{code:java}
linq { // return an Iterator
from c of categories
from a of c.articles  // another join
where c.name == 'Groovy'
orderBy a.voteCount desc // order by
select Article { // create an Article instance
a.name
a.voteCount 
categoryName = c.name
}
}
{code}

*TO BE CONTINUED...*



> Create a LINQ-like DSL
> --
>
> Key: GROOVY-8258
> URL: https://issues.apache.org/jira/browse/GROOVY-8258
> Project: Groovy
>  Issue Type: Improvement
>Reporter: Daniel Sun
>
> *Pojos:*
> {code:java}
> class Category {
>String name
>List articles
> }
> class Article {
>   String name
>   Integer voteCount
>   String categoryName
> }
> {code}
> *Example1:*
> {code:java}
> linq { // return an Iterator>
> from c of categories
> join a of articles on a.categoryName == c.name // join
> where c.name == 'Groovy'
> orderBy a.voteCount desc // order by
> limit 100 offset 50 // pagination
> select { // create a map, its keys: articleName, voteNum, categoryName
> articleName = a.name
> a.voteCount 
> categoryName = c.name
> }
> }
> {code}
> *Example2:*
> {code:java}
> linq { // return an Iterator>
> from c of categories
> join a of {
> from tempA of articles
> where tempA.voteCount > 10
> select tempA
> } on a.categoryName == c.name // join
> where c.name == 'Groovy'
> orderBy a.voteCount desc // order by
> limit 100 offset 50 // pagination
> select { // create a map, its keys: articleName, voteNum, categoryName
> articleName = a.name
> a.voteCount 
> categoryName = c.name
> }
> }
> {code}
> *Example3:*
> {code:java}
> linq { // return an Iterator
> from c of categories
> from a of c.articles  // another join
> where c.name == 'Groovy'
> orderBy a.voteCount desc // order by
> select Article { // create an Article instance
> a.name
> a.voteCount 
> categoryName = c.name
> }
> }
> {code}
> *TO BE CONTINUED...*



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Updated] (GROOVY-8258) Create a LINQ-like DSL

2017-07-16 Thread Daniel Sun (JIRA)

 [ 
https://issues.apache.org/jira/browse/GROOVY-8258?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Sun updated GROOVY-8258:
---
Description: 
*Pojos:*
{code:java}
class Category {
   String name
   List articles
}

class Article {
  String name
  Integer voteCount
  String categoryName
}
{code}


*Example1:*
{code:java}
linq { // return an Iterator>
from c of categories
join a of articles on a.categoryName == c.name // join
where c.name == 'Groovy'
orderBy a.voteCount desc // order by
limit 100 offset 50 // pagination
select { // create a map, its keys: articleName, voteNum, categoryName
articleName = a.name
a.voteCount 
categoryName = c.name
}
}
{code}

*Example2:*
{code:java}
linq { // return an Iterator
from c of categories
from a of c.articles  // another join
where c.name == 'Groovy'
orderBy a.voteCount desc // order by
select Article { // create an Article instance
a.name
a.voteCount 
categoryName = c.name
}
}
{code}

*TO BE CONTINUED...*


  was:
*Pojos:*
{code:java}
class Category {
   String name
   List articles
}

class Article {
  String name
  Integer voteCount
  String categoryName
}
{code}


*Example1:*
{code:java}
linq { // return an Iterator>
from c of categories
join a of articles on a.categoryName == c.name // join
where c.name == 'Groovy'
orderBy a.voteCount desc // order by
limit 100 offset 50 // pagination
select { // create a map, its keys: articleName, voteNum, categoryName
articleName = a.name
a.voteCount 
categoryName = c.name
}
}
{code}

*Example2:*
{code:java}
linq { // return an Iterator
from c of categories
from a of c.articles  // join
where c.name == 'Groovy'
orderBy a.voteCount desc // order by
select Article { // create an Article instance
a.name
a.voteCount 
categoryName = c.name
}
}
{code}

*TO BE CONTINUED...*



> Create a LINQ-like DSL
> --
>
> Key: GROOVY-8258
> URL: https://issues.apache.org/jira/browse/GROOVY-8258
> Project: Groovy
>  Issue Type: Improvement
>Reporter: Daniel Sun
>
> *Pojos:*
> {code:java}
> class Category {
>String name
>List articles
> }
> class Article {
>   String name
>   Integer voteCount
>   String categoryName
> }
> {code}
> *Example1:*
> {code:java}
> linq { // return an Iterator>
> from c of categories
> join a of articles on a.categoryName == c.name // join
> where c.name == 'Groovy'
> orderBy a.voteCount desc // order by
> limit 100 offset 50 // pagination
> select { // create a map, its keys: articleName, voteNum, categoryName
> articleName = a.name
> a.voteCount 
> categoryName = c.name
> }
> }
> {code}
> *Example2:*
> {code:java}
> linq { // return an Iterator
> from c of categories
> from a of c.articles  // another join
> where c.name == 'Groovy'
> orderBy a.voteCount desc // order by
> select Article { // create an Article instance
> a.name
> a.voteCount 
> categoryName = c.name
> }
> }
> {code}
> *TO BE CONTINUED...*



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Updated] (GROOVY-8258) Create a LINQ-like DSL

2017-07-16 Thread Daniel Sun (JIRA)

 [ 
https://issues.apache.org/jira/browse/GROOVY-8258?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Sun updated GROOVY-8258:
---
Description: 
*Pojos:*
{code:java}
class Category {
   String name
   List articles
}

class Article {
  String name
  Integer voteCount
  String categoryName
}
{code}


*Example1:*
{code:java}
linq { // return an Iterator>
from c of categories
join a of articles on a.categoryName == c.name // join
where c.name == 'Groovy'
orderBy a.voteCount desc // order by
limit 100 offset 50 // pagination
select { // create a map, its keys: articleName, voteNum, categoryName
articleName = a.name
a.voteCount 
categoryName = c.name
}
}
{code}

*Example2:*
{code:java}
linq { // return an Iterator
from c of categories
from a of c.articles  // join
where c.name == 'Groovy'
orderBy a.voteCount desc // order by
select Article { // create an Article instance
a.name
a.voteCount 
categoryName = c.name
}
}
{code}

*TO BE CONTINUED...*


  was:
*Pojos:*
{code:java}
class Category {
   String name
   List articles
}

class Article {
  String name
  Integer voteCount
  String categoryName
}
{code}


*Example1:*
{code:java}
linq { // return an Iterator>
from c of categories
from a of c.articles  // join
where c.name == 'Groovy'
orderBy a.voteCount desc // order by
limit 100 offset 50 // pagination
select { // create a map, its keys: articleName, voteNum, categoryName
articleName = a.name
a.voteCount 
categoryName = c.name
}
}
{code}

*Example2:*
{code:java}
linq { // return an Iterator
from c of categories
from a of c.articles  // join
where c.name == 'Groovy'
orderBy a.voteCount desc // order by
select Article { // create an Article instance
a.name
a.voteCount 
categoryName = c.name
}
}
{code}

*TO BE CONTINUED...*



> Create a LINQ-like DSL
> --
>
> Key: GROOVY-8258
> URL: https://issues.apache.org/jira/browse/GROOVY-8258
> Project: Groovy
>  Issue Type: Improvement
>Reporter: Daniel Sun
>
> *Pojos:*
> {code:java}
> class Category {
>String name
>List articles
> }
> class Article {
>   String name
>   Integer voteCount
>   String categoryName
> }
> {code}
> *Example1:*
> {code:java}
> linq { // return an Iterator>
> from c of categories
> join a of articles on a.categoryName == c.name // join
> where c.name == 'Groovy'
> orderBy a.voteCount desc // order by
> limit 100 offset 50 // pagination
> select { // create a map, its keys: articleName, voteNum, categoryName
> articleName = a.name
> a.voteCount 
> categoryName = c.name
> }
> }
> {code}
> *Example2:*
> {code:java}
> linq { // return an Iterator
> from c of categories
> from a of c.articles  // join
> where c.name == 'Groovy'
> orderBy a.voteCount desc // order by
> select Article { // create an Article instance
> a.name
> a.voteCount 
> categoryName = c.name
> }
> }
> {code}
> *TO BE CONTINUED...*



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Updated] (GROOVY-8258) Create a LINQ-like DSL

2017-07-16 Thread Daniel Sun (JIRA)

 [ 
https://issues.apache.org/jira/browse/GROOVY-8258?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Sun updated GROOVY-8258:
---
Description: 
*Pojos:*
{code:java}
class Category {
   String name
   List articles
}

class Article {
  String name
  Integer voteCount
  String categoryName
}
{code}


*Example1:*
{code:java}
linq { // return an Iterator>
from c of categories
from a of c.articles  // join
where c.name == 'Groovy'
orderBy a.voteCount desc // order by
limit 100 offset 50 // pagination
select { // create a map, its keys: articleName, voteNum, categoryName
articleName = a.name
a.voteCount 
categoryName = c.name
}
}
{code}

*Example2:*
{code:java}
linq { // return an Iterator
from c of categories
from a of c.articles  // join
where c.name == 'Groovy'
orderBy a.voteCount desc // order by
select Article { // create an Article instance
a.name
a.voteCount 
categoryName = c.name
}
}
{code}

*TO BE CONTINUED...*


  was:

*Pojos:*
{code:java}
class Category {
   String name
   List articles
}

class Article {
  String name
  Integer voteCount
  String categoryName
}
{code}


*Example1:*
{code:java}
linq { // return an Iterator>
from c of categories
from a of c.articles  // join
where c.name == 'Groovy'
orderBy a.voteCount desc // order by
select { // create a map, its keys: articleName, voteNum, categoryName
articleName = a.name
a.voteCount 
categoryName = c.name
}
}
{code}

*Example2:*
{code:java}
linq { // return an Iterator
from c of categories
from a of c.articles  // join
where c.name == 'Groovy'
orderBy a.voteCount desc // order by
select Article { // create an Article instance
a.name
a.voteCount 
categoryName = c.name
}
}
{code}

*TO BE CONTINUED...*



> Create a LINQ-like DSL
> --
>
> Key: GROOVY-8258
> URL: https://issues.apache.org/jira/browse/GROOVY-8258
> Project: Groovy
>  Issue Type: Improvement
>Reporter: Daniel Sun
>
> *Pojos:*
> {code:java}
> class Category {
>String name
>List articles
> }
> class Article {
>   String name
>   Integer voteCount
>   String categoryName
> }
> {code}
> *Example1:*
> {code:java}
> linq { // return an Iterator>
> from c of categories
> from a of c.articles  // join
> where c.name == 'Groovy'
> orderBy a.voteCount desc // order by
> limit 100 offset 50 // pagination
> select { // create a map, its keys: articleName, voteNum, categoryName
> articleName = a.name
> a.voteCount 
> categoryName = c.name
> }
> }
> {code}
> *Example2:*
> {code:java}
> linq { // return an Iterator
> from c of categories
> from a of c.articles  // join
> where c.name == 'Groovy'
> orderBy a.voteCount desc // order by
> select Article { // create an Article instance
> a.name
> a.voteCount 
> categoryName = c.name
> }
> }
> {code}
> *TO BE CONTINUED...*



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Updated] (GROOVY-8258) Create a LINQ-like DSL

2017-07-16 Thread Daniel Sun (JIRA)

 [ 
https://issues.apache.org/jira/browse/GROOVY-8258?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Sun updated GROOVY-8258:
---
Description: 

*Pojos:*
{code:java}
class Category {
   String name
   List articles
}

class Article {
  String name
  Integer voteCount
  String categoryName
}
{code}


*Example1:*
{code:java}
linq { // return an Iterator>
from c of categories
from a of c.articles  // join
where c.name == 'Groovy'
orderBy a.voteCount desc // order by
select { // create a map, its keys: articleName, voteNum, categoryName
articleName = a.name
a.voteCount 
categoryName = c.name
}
}
{code}

*Example2:*
{code:java}
linq { // return an Iterator
from c of categories
from a of c.articles  // join
where c.name == 'Groovy'
orderBy a.voteCount desc // order by
select Article { // create an Article instance
a.name
a.voteCount 
categoryName = c.name
}
}
{code}

*TO BE CONTINUED...*


  was:

*Example1:*
{code:java}
linq { // return an Iterator>
from c of categories
from a of c.articles  // join
where c.name == 'Groovy'
orderBy a.voteNum desc // order by
select { // create a map, its keys: articleName, voteNum, categoryName
articleName = a.name
a.voteNum
categoryName = c.name
}
}
{code}

*Example2:*
{code:java}
linq { // return an Iterator
from c of categories
from a of c.articles  // join
where c.name == 'Groovy'
orderBy a.voteNum desc // order by
select Article { // create an Article instance
a.name
a.voteNum
categoryName = c.name
}
}

TO BE CONTINUED...

{code}



> Create a LINQ-like DSL
> --
>
> Key: GROOVY-8258
> URL: https://issues.apache.org/jira/browse/GROOVY-8258
> Project: Groovy
>  Issue Type: Improvement
>Reporter: Daniel Sun
>
> *Pojos:*
> {code:java}
> class Category {
>String name
>List articles
> }
> class Article {
>   String name
>   Integer voteCount
>   String categoryName
> }
> {code}
> *Example1:*
> {code:java}
> linq { // return an Iterator>
> from c of categories
> from a of c.articles  // join
> where c.name == 'Groovy'
> orderBy a.voteCount desc // order by
> select { // create a map, its keys: articleName, voteNum, categoryName
> articleName = a.name
> a.voteCount 
> categoryName = c.name
> }
> }
> {code}
> *Example2:*
> {code:java}
> linq { // return an Iterator
> from c of categories
> from a of c.articles  // join
> where c.name == 'Groovy'
> orderBy a.voteCount desc // order by
> select Article { // create an Article instance
> a.name
> a.voteCount 
> categoryName = c.name
> }
> }
> {code}
> *TO BE CONTINUED...*



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Created] (GROOVY-8258) Create a LINQ-like DSL

2017-07-16 Thread Daniel Sun (JIRA)
Daniel Sun created GROOVY-8258:
--

 Summary: Create a LINQ-like DSL
 Key: GROOVY-8258
 URL: https://issues.apache.org/jira/browse/GROOVY-8258
 Project: Groovy
  Issue Type: Improvement
Reporter: Daniel Sun



*Example1:*
{code:java}
linq { // return an Iterator>
from c of categories
from a of c.articles  // join
where c.name == 'Groovy'
orderBy a.voteNum desc // order by
select { // create a map, its keys: articleName, voteNum, categoryName
articleName = a.name
a.voteNum
categoryName = c.name
}
}
{code}

*Example2:*
{code:java}
linq { // return an Iterator
from c of categories
from a of c.articles  // join
where c.name == 'Groovy'
orderBy a.voteNum desc // order by
select Article { // create an Article instance
a.name
a.voteNum
categoryName = c.name
}
}

TO BE CONTINUED...

{code}




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)