Re: Proxying how to?!? (was: changing dynamically the name of classes in a source code)

2016-03-29 Thread OC
Jason, thanks for a quick response! On 29. 3. 2016, at 19:09, "Winnebeck, Jason" wrote: > You still have to follow the rules of Java bytecode right, that's why I wrote it's a Java fault (inherited by Groovy), not a Groovy fault. > that is your class

Re: Check if List is of specific size and elements of specific type

2016-03-29 Thread Marcos Carceles
Would this work? listVariable*.class == [Integer, Integer] On 29 March 2016 at 12:25, Maarten Boekhold wrote: > Hi, > > Is there a quick and easy way to do something like: > > assert listVariable == [int, int] > > eg, the list is of size 2 and each element is an int? > >

Re: Check if List is of specific size and elements of specific type

2016-03-29 Thread Søren Berg Glasius (GR8Conf EU)
Hi Maarten, You could be close with this. def listVariable = [1,2] assert listVariable*.getClass() == [int, int] but your assert will have to be assert listVariable*.getClass() == [Integer, Integer] since ints are actually the object type Integer Best regards, Søren Berg Glasius GR8Conf

Re: Check if List is of specific size and elements of specific type

2016-03-29 Thread Søren Berg Glasius (GR8Conf EU)
@dinko yeah, that's why I choose to do my example with listVariable*.getClass()  Best regards, Søren Berg Glasius GR8Conf Europe organizing team GR8Conf ApS Mobile: +45 40 44 91 88, Web: www.gr8conf.eu, Skype: sbglasius  Company Address: Buchwaldsgade 50, 5000 Odense C, Denmark Personal Address:

Re: Check if List is of specific size and elements of specific type

2016-03-29 Thread Dinko Srkoč
On 29 March 2016 at 12:29, Marcos Carceles wrote: > Would this work? > > listVariable*.class == [Integer, Integer] It would in this particular example, but this may be dangerous for some other cases. Try e.g. this: [1, [:], [class: 1]]*.class Cheers, Dinko > > On

Re: changing dynamically the name of classes in a source code

2016-03-29 Thread frenchy48
answer found Groovy is fantastic! Since I use the groovyConsole for my teaching scripts I created a subclass of groovy console then modified the CompilerConfiguration to accept an importCustomizer that aliases import! fun! - member of Grumpy Old Programmers -- View this message in context: