I'm running a script made in Groovy from Soap UI and the script needs to generate lots of files.
Those files have also in the name two numbers from a list (all the combinations in that list are different), and there are 1303 combinations
available and the script generates just 1235 files.
A part of the code is:
filename = groovyUtils....
As a language how stable is Groovy? Do any big names use it?
...
I'm trying to figure out how to remove an item from a list in groovy from within a loop.
static main(args) {
def list1 = [1, 2, 3, 4]
for(num in list1){
if(num == 2)
list1.remove(num)
}
println(list1)
}
...
Hi folks,
I've a problem.
I want to have nice dynamic groovy classes to represent an ugly XML structure (unfortunately JAXB, XmlBeans etc. is not possible).
For this goal I need case-sensitive properties to map the element values from XML to my classes.
But Groovy generates automatically lowercase property names due to the JavaBeans sp...
Lets assume that I have the following configuration in my conf/InjectionConfig.groovy file:
x {
a = { attrs, body -> out << "hello" }
b = { attrs, body -> out << "goodbye" }
}
and that I have a simple taglib such as
class XTagLib {
static namespace = "x"
}
What I want to do is that when I type <x:a /> to any of my view...
I'm trying to write my first groovy class. When I do so, Eclipse complains about syntax errors as though it's parsing a Java file. It wants semicolons on the end of each line, it doesn't recognize the "def" keyword, etc.
I have both Groovy 1.7.5 and the latest Groovy Eclipse plugin installed. I have also converted the project to a Gr...
I have a list of events that i need to fire when a user takes an action and an event manager that fires these events.
Originally i used to fire the events explicitly in this way
EventManager.publish(new SendNotificationEvent())
Then i wanted to change that to something like
EventManager.publishSendNotificationEvent()
To do that,...
Ok, this should be easy...
I'm new to groovy and I'm looking to implement the following logic:
def testFiles = findAllTestFiles();
So far, I've come up with the code below which successfully prints all files names. However, instead of printing, I just need to put them into a collection. Of course, I could do this the old java way: ...
have a Grails domain object that has a custom static function to grab data from the database
class Foo {
/* member variables, mapping, constraints, etc. */
static findByCustomCriteria(someParameter, List listParameter) {
/* code to get stuff from the database... */
/*
Return value is a map
...
Hi, I'm trying to extract two blocks of code from a text file using Java regex. However, I can only extract the last block. Could some one point out what is is wrong with mycode?
thanks.
here it is
import java.util.regex.*;
INPUT_START_OR_BLANK_LINE = /(?:\A|\n\n)/
FOUR_SPACES_OR_TAB = /(?:[ ]{4}|\t)/
CODE = /.*\n+/
CODE_LINES = /(...
If I understand correctly, the purpose of groovy and grails are to execute without (visible) compilation. However, I have inherited some old grails code that I can't build any more.
I can see the advantages of having a build.xml file for special purposes, but, considering that the programming nature of Grails is to run on the fly, does...
I have an relatively old Grails app that uses ant to build the application. In the test server it build without any problems, but when I try to run it on my PC, I get a consistent error:
Caused by: jar:file:/C:/ant/apache-ant-1.8.0/lib/ant.jar!/org/apache/tools/ant/antlib.xml:37: Problem: failed to create task or type componentdef
C...
Groovy has a nice operator for safe dereferencing, which helps to avoid NullPointerExceptions:
variable?.method()
The method will only be called, if variable is not null.
Is there a way to do the same in Python? Or do I have to write if variable: variable.method()?
...