Hi,
Registrations for GR8Conf EU ends one week from now, Monday May 23rd.
You do not want to miss this year's event! Here you can learn all about Groovy,
Grails and Gradle from the project founders and core developers!
From the Groovy core team you can meet: Guillaume Laforge, Cedric Champea
Grumble. Still doesn't work, but it may be because I'm working within a
DSL (Artifactory)
Thanks!!!
On Mon, May 16, 2016 at 12:01 PM, Sergei Egorov wrote:
> Make it static, i.e. append "static" before "def"
>
> On Mon, May 16, 2016 at 6:57 PM Guy Matz wrote:
>
>> Thanks! Not working, though.
Make it static, i.e. append "static" before "def"
On Mon, May 16, 2016 at 6:57 PM Guy Matz wrote:
> Thanks! Not working, though. Getting:
> No such property: compareVersions for class: Sorters
>
> with:
>
> class Sorters {
> def compareVersions = { afile, bfile ->
> return getVersi
Thanks! Not working, though. Getting:
No such property: compareVersions for class: Sorters
with:
class Sorters {
def compareVersions = { afile, bfile ->
return getVersion(afile).toInteger() <=> getVersion(bfile).toInteger()
}
}
and called with:
res.sort(Sorters.compareVersions
Hi,
You can create "sortByVersions" extension method as well:
http://mrhaki.blogspot.com.ee/2013/01/groovy-goodness-adding-extra-methods.html
On Mon, May 16, 2016 at 6:44 PM Søren Berg Glasius (GR8Conf EU) <
sbglas...@gr8conf.org> wrote:
> Hi
>
> You can define it in a class as a static closure
Hi
You can define it in a class as a static closure
class Sorters {
static compareVersions = { a,b ->
return getVersion(a).toInteger() <=> getVersion(b).toInteger()
}
}
and use it like:
list.sort(Sorters.compareVersions)
Best regards,
Søren Berg Glasius
GR8Conf Europe org
Thanks! Now, I have a number of methods that need access to that closure .
. . Can I make the closure global? Is there a better way?
Thanks again,
Guy
On Mon, May 16, 2016 at 11:30 AM, Søren Berg Glasius (GR8Conf EU) <
sbglas...@gr8conf.org> wrote:
> Hi Guy
>
> Just assign the variable
>
> de
Hi Guy
Just assign the variable
def comapreVersions = { a,b ->
return getVersion(a).toInteger() <=> getVersion(b).toInteger()
}
and then use it in your sort:
list.sort(compareVersions)
Best regards,
Søren Berg Glasius
GR8Conf Europe organizing team
GR8Conf ApS
Mobile: +45 40 44 91
Hi!
I have to sort a list of strings based on a number within the string . . .
I am able to sort using something like:
list.sort( { a,b -> getVersion(a) <=> getVersion(b)})
I need to use this in a bunch of places in my code and was hoping to
replace it with a method, like:
list.sort( compareVersio
Hi,
I have a DSL which I can successfully execute as long as I don’t add an
ASTTransformationCustomizer(TypeChecked) to check for compiler errors. But as
soon as I add this customizer (uncomment in the following snippet), I get a
ClassNotFoundException for groovy.lang.GroovyObject:
class DSLR
10 matches
Mail list logo