groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Theodorou <blackd...@gmx.org>
Subject Re: Simple question.. how to call a java class method in Groovy Script
Date Mon, 22 May 2017 18:03:20 GMT
On 22.05.2017 19:40, RJ wrote:
> Here is my script. Highlighted the method call.. tried some google
> searches for the syntax. Thanks for the help!
>
> import java.util.*
> import com.example.auth.user;
>
> class EBSAttrRelease {
>      def Map<UserString, List<UserObject>> run(final UserObject... args)
{
>      def userid=com.example.auth.user.getId()
>      return [MYLOGINID:userid]
>      }
> }

try "import com.example.auth.user as User" instead of "import 
com.example.auth.user" and then "def userid=User.getId()"... assuming of 
course that getId is a static method in the class com.example.auth.user

bye Jochen

Mime
View raw message