groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christophe Henry <christo...@c-henry.fr>
Subject Calling Groovy classes from Java?
Date Wed, 12 Aug 2015 15:55:37 GMT
Hello,

I was wondering how much Groovy classes could be called from Java.

I am aware that solutions to call Groovy scripts are available like 
GroovyScriptLoader but I was thinking about simpler solutions.

This afternoon, while working on a classic Maven project, I noticed 
something weird : some Groovy classes were in the auto-completion list 
that IntelliJ was displaying me. So I decided to do a test and try 
calling a Groovy class from Java.

So I tried the following code :

```
String[] strings = { "Hello world"} ;
System.out.println(new GStringImpl(new Object[0], strings) ;
```

And it worked. So I suppose this is possible, in a way, that, if I wrote 
a Groovy class, I could instantiate it and call it's methods from Java 
code, right?
-- 
/Cordialement,
Christophe Henry/

Mime
View raw message