Skip to content

Commit

Permalink
Added support for count() methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Abd authored and Alex Abd committed Nov 24, 2015
1 parent 611ef8a commit 5981163
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/groovy/plastic/criteria/PlasticCriteria.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,14 @@ class PlasticCriteria {
return _handleUniqueResult(_maxAndOffset(ls))
}

def count(params, Closure clos){
list(params, clos).size()
}

def count(Closure clos) {
list(clos).size()
}

def _maxAndOffset(ls){
if(_offset >= ls.size() || ls.size() == 0) return []
if(_offset) ls = ls[_offset..-1]
Expand Down

0 comments on commit 5981163

Please sign in to comment.