groovy

Why do so many insist on dragging the JVM into new applications?

For example, I'm running into developers and architects who are scared to death of Rails apps, but love the idea of writing new Grails apps. From what I've seen, there is a LOT of resource overhead that goes into using the JVM to support languages such as Groovy, JRuby and Jython instead of straight Ruby or Python. Ruby and Python ca...

I'm looking for a solution to the excessive verboseness of Java without using Groovy

I like how Groovy makes all of your instance variables and class variables public and writes getters and setters on your behalf. This saves a lot of unnecessary coding. On the other hand, my boss hates it, making me very sad :( Is there a way to achieve the conciseness of Groovy in Java without having to use Groovy or some other framewo...

Are there any significant differences between blocks in Ruby vs Groovy?

I've gotten used to blocks in Ruby and would like to use them in Java. Groovy seems to offer a similar feature but I don't know enough about Groovy to understand whether there are any significant differences in syntax and functionality. Is a Ruby block equivalent to a Groovy block? ...

Importing Groovy classes in a GWT module in Intellij

Basically I can't even import Groovy classes in a regular GWT EntryPoint: import com.google.gwt.core.client.EntryPoint; // OK import groovy.lang.Binding; // NOT OK import groovy.util.GroovyScriptEngine; // NOT OK Intellij 8.0's inspector keeps telling me this: Class 'groovy.lang.Binding' is not present in JRE Emulation Library so it...

Groovy + JPA + Spring not working

I have the following java class: package domain; //imports @Entity public class User { @Id @GeneratedValue private long id; private String name; private String password; private String mail; //Getters, Setters and Constructors } When I change the file extension to .groovy, the application stops working. In ...

Beginners problem with Groovy on Grails

Hi! I am a newbie at Groovy and I want to modify one example I've found at the Internet (the blog one). I've defined two classes Post and Comment as follows: class Post { static hasMany = [comments:Comment] String title String teaser String content Date lastUpdated SortedSet comments static constraints = { title(nullable...

Groovy: How to access objects with Id tag?

Hello, I have the following Groovy+SwingBuilder code. In one panel I generate checkboxes and in another panel I want to access the values of the checkboxes. The code looks basically likes this: def optionsmap = [ foo : "value_foo", bar : "value_bar"] SwingBuilder.build() { frame(title:'demo1',...

Grails 1.0.4 with Acegi 0.4.1 upgraded to Grails 1.1 and Acegi 0.5.1 with problems!

Hi guys! I upgraded my Grails 1.0.4 application to 1.1. I also upgraded from acegi 0.4.1 to 0.5.1! I had some problems but i'm working on it and i think this is my last problem. When i start my grails application i get the following error message: loading security config ... ...

groovy execute with parameters containing spaces

How do I provide arguments containing spaces to the execute method of strings in groovy? Just adding spaces like one would in a shell does not help: println 'ls "/tmp/folder with spaces"'.execute().text This would give three broken arguments to the ls call. ...

Groovy expando metaclass

Hi, I've developed a Class that has some methods that augment Integer, it mainly lets me do this: def total = 100.dollars + 50.euros Now I have to extend Integer.metaClass doing something like this: Integer.metaClass.getDollars = {-> Money.Dollar(delegate) } I tried putting that at the bottom of the file, before the Money class...

Grails Acegi Plugin springsecurity.GrailsDaoImpl - User [admin] has no GrantedAuthority

Hi guys, i upgraded my grails 1.0.4 + acegi 0.4.1 project to grails 1.1 with acegi 0.5.1. I'm able to start my application without errors, but when i want to login i get a "wrong username or password" message. Grails-shell output is: 2009-04-26 12:38:46,997 [403984690@qtp0-0] ERROR springsecurity.GrailsDaoImpl - User [admin] ...

How stable is the Groovy language?

We're writing a large production system in Java, and I'm considering whether or not we can write some of the components in one of the JVM-based dynamic languages. Groovy appears to be the best choice from the Java interoperability standpoint. But is the Groovy implementation reliable enough to use in production (I would assume so), and i...

Class cast exception in Groovy

I want to upload an image using a groovy on grails. My gsp page is as follows (I am showing a simplified version of the original) <g:form controller="post" action="save" enctype="multipart/form-data"> My picture <input type="file" name="myPicture" /> <g:submitButton name="submit" value="Save"/> </g:form> My dom...

Help-balloons in groovy on grails

Hi! I am using the help-balloons plugin I would like to use it parametrized. I mean, the messages should come from a properties file. In the documentation appears the following: <g:helpBalloon code="user.name" suffix=".help"/> In this last example, the code attribute is used to look up the balloon's title within the message bundle an...

Working example to start canoo webtest from Groovy?

I would like to start a simple webtest from Groovy with Canoo. The example Canoo Example is not working. I think I am missing something with the Antbuilder class. Especially the "config" part, where a HashMap of properties is passed. I have tried different ways to pass properties but my most basic approach: config_map = ['host':'www.goo...

How to implement openID using openid4java in GSP

How to build openID ReturnURL in gsp?? Define a ReturnURL This is the endpoint where your webapp will receive and process the authentication responses from the OpenID Provider. String _returnURL = "http://example.com/openid"; Reference:http://code.google.com/p/openid4java/wiki/QuickStart ...

Groovy: meaning of 'this' inside a closure

Hi, The following example is adapted from 'Groovy in Action' class Mother { Closure birth() { def closure = { caller -> [this, caller] } return closure } } Mother julia = new Mother() closure = julia.birth() con...

implementing Interfaces with closures in Groovy - what method was called?

There is an idiom in groovy to implement an Interface with a single closure. The closure must be prepared to handle whatever arguments are passed. That works fine. But how does one determine what method was called at the interface? interface X { void f(); void g(int n); void h(String s, int n); } x = {Object[] args -> println "method c...

Using java classes in Grails

I have a Java\Spring\Hibernate application - complete with domain classes which are basically Hibernate POJOs There is a piece of functionality that I think can be written well in Grails. I wish to reuse the domain classes that I have created in the main Java app What is the best way to do so ? Should I write new domain classes exten...

How do you configure GroovyConsole so I don't have to import libraries at startup?

I have a groovy script that uses a third party library. Each time I open the application and attempt to run my script I have to import the proper library. I would like to be able to open GroovyConsole and run my application without having to import the library. ...