I am writing my first taglib as part of a plugin and I would like to document it. Adding javadoc (is there any place that documents groovydoc or is it really the same thing?) doesn't seem to work for non-methods.
Specifically, is it possible to document the def mytag in:
/**
* This doc shows up
*/
class MyTagLib {
static namespace ...
How do I count the number of messages where my body length is between 0 and 25 characters long?
Message.countBy('from Message m where m.body.length <= 25')
Unfortunately for me, countBy does not take a string parameter.
...
Hi, I'm working on a XML-document with Groovy and test a node for a certain attribute, which has a namespace prefix. How could it work:
in groovy-script:
...
Element.Subelement.each {
if (it.'@type'=='ns2:xyType')
...do what ever...
}
in XML document:
<Element>
<Subelement xsi:type="ns2:xyType">
<!-- or another type...
I'm able to run Groovy scripts from Groovy using
proc = "cmd /c groovy BillingServer.groovy".execute(null, new File("C:\"))
However, I can't find a way to then terminate/kill the process. waitForOrKill(1) and destroy() "act" like they've worked, but the external process continues to run. Calling exitValue() fails with
java.lang.Ill...
Let's say I have an existing application written in Java which I wish to add scripting support to. This is fairly trivial with Groovy (and just as trivial in .Net with any of the Iron range of dynamic languages).
As trivial as adding the support is, it raises a whole host of questions about script execution and security - and how to imp...
This is the controller
class JavaMailerController {
JavaMailerService javamailerservice
def x = {javamailerservice.serviceMethod()} }
This is the Service
import javax.mail.; import
javax.mail.internet.; import
java.util.*;
class JavaMailerService {
boolean transactional = false
def serviceMethod() { String d_ema...
I'm trying to determine whether an XML element exists with Groovy's XmlSlurper. Is there a way to do this? For example:
<foo>
<bar/>
</foo>
How do I check whether the bar element exists?
...
Hi,
As a "learn Groovy" project, I'm developing a site to manage my media collection (MP3, MP4, AVI, OGG) and I wasn't able to find any open source library to retrieve meta data from this files. I was thinking of something like Linux's file command.
I've found few libraries on Java that do one or the other (like mp3info), but not a tota...
Hi I'm looking to parse spreadsheets (xls/ods) in Groovy. I have been using the Roo library for Ruby and was looking to try the same tasks in Groovy, as Java is already installed on a development server I use, and I would like to keep the number of technologies on the server to a simple core few.
I am aware that the ods format is zipped...
I'd just like to play a little bit with groovy
I was thinking about developing my own-tiny web framework, something very simple and manageable...
So i'd like tou use GSP pages whtout having to install the whole grails stuff, with all its dependencies and behind-the-scenes frameworks...
can anyone provide me detailed instructions on wh...
I use GORM to generate my database's DDL from groovy classes. Which is great. However, the order of fields in the generated SQL is not the same as the order of fields in the class. For example, if I create the class
class Person
{
String firstName
String lastName
String address
String email
}
the following SQL is generated ...
I would like a method/closure which works like this
println TimeDifference.format( System.currentMilliSeconds()-1000*60*60*24*7*6 )
and prints
1 month, 3 weeks, 2 days, 45 hours and 3 minutes ago.
Is there an off the shelf solution for this?
...
like this:
Groovy:
map = ['a':1,'b':2]
doubler = this.&doubleMethod
map.each(doubler)
println map
What's the "&" semanteme used here?
...
I have a hibernate query in grails
Book.findAllByRating(4)
In the above query i want only 5 number of outputs.How do I limit the output to 5?
...
I'm thinking of something like Jython/Jango? Does this exist? Or does Jython allow you to do everything-Python in Java including Django (I'm not sure how Jython differs from Python)?
...
Are there any figures for its adoption in corporate environments? Does anyone know of large corporations that have adopted it for projects?
...
The method Concat() does not modify the original value. It returns a new value.
like this:
String str = "good";
str.concat("ness");
System.out.println(str); //"good"
But some method modify the original value. Why?
In Groovy:
def languages = ["Java", "Groovy", "JRuby"]
languages.reverse()
===> [JRuby, Groovy, Java]
println language...
I'm looking to run some un-verified scripts (written in a yet-to-be-determined language, but needs to be Java-based, so JRuby, Groovy, Jython, BeanShell, etc are all candidates). I want these scripts to be able to do some things and restricted from doing other things.
Normally, I'd just go use Java's SecurityManager and be done with it....
Is there some way to use default parameters values with closures in Groovy?
This is what I tried so far:
class Persona {
String name
Persona( String name ) {
this.name = name
}
String salute( String salute = "Hola" ) {
salute + ' ' + this.name
}
}
Persona.metaClass.salute2 = {
String salute ...
Using Groovy's package name convention, I can intercept Groovy method calls to a Java method like so:
package groovy.runtime.metaclass.org.myGang.myPackage
class FooMetaClass extends groovy.lang.DelegatingMetaClass
{
StringMetaClass(MetaClass delegate)
{
super(delegate);
}
public Object getProperty(Object a, St...