Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 00A5D200C8B for ; Mon, 22 May 2017 20:13:28 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id F36B3160BBF; Mon, 22 May 2017 18:13:27 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 45E1C160BAD for ; Mon, 22 May 2017 20:13:27 +0200 (CEST) Received: (qmail 99495 invoked by uid 500); 22 May 2017 18:13:24 -0000 Mailing-List: contact users-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@groovy.apache.org Delivered-To: mailing list users@groovy.apache.org Received: (qmail 99485 invoked by uid 99); 22 May 2017 18:13:24 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 May 2017 18:13:24 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 63646C0B7D for ; Mon, 22 May 2017 18:13:24 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -0.397 X-Spam-Level: X-Spam-Status: No, score=-0.397 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-2.796, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id WmfPeSMhH4sI for ; Mon, 22 May 2017 18:13:23 +0000 (UTC) Received: from mail-oi0-f43.google.com (mail-oi0-f43.google.com [209.85.218.43]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 4C5C85FDFE for ; Mon, 22 May 2017 18:13:22 +0000 (UTC) Received: by mail-oi0-f43.google.com with SMTP id w10so172312938oif.0 for ; Mon, 22 May 2017 11:13:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=DQ9nl4YMrmmnlkk39+hpV2aj1jOkEsZwwtOgBkzDX24=; b=sBg+oVDb1wOwtOIfIFdQeGZQDCI1bu3LCTfw4Gp3b3GrcNDKlsJHD+kpa5X/U5xVIe x8QE944M1MP4/kDz9GJLx4MNlBiu6V8unK79vOkKlr/vY26LE9Hs+Q6P/JINl9E3oImS RqiUUyenvd/goedmaJjHoqCiQBkLwWJ84UtO2Ft8JuHHPOyO47vA5qwyojutkWHwqZeE W5dq6uMKREhGwRT3BBoSstubb0qQB4POBMnWD805hpOqjRGbxbOiIfjsQNK2n3IvHaHH n6OWHGMEXEXWo+13NroaQAq2qraKpwuGG2U7K4/y7s5EV4AykOG5Ftk7C2CWvI/x0glj dU1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=DQ9nl4YMrmmnlkk39+hpV2aj1jOkEsZwwtOgBkzDX24=; b=jXXbgH+xEZRjZGnQg+ak/JQgyD8fBUKMYSw82SlTtCLM4MhBB07yv/492rSzoMjSzz yZeanihfueUWKgDRdN3T3RPjlRUSpxS+dEFtDCJAzXswLViXDie0nj8Llcc8PaZkmK58 JFLur20QaX/hS8eaRCqFTDkdZyCTdfczFJKXGYXKsKGlT1ATTphU8p1hvFNrHOuzKNQj Rv+usUq1JSH4IStyXnHRQk5VsfCfy3676hJIqr+TDKw2HIZ/JXGlNGtzS84UVMRgfBRf AlOm0+2V0jnDzNtpY0psvD8OcEt+lFEU6+iRcAT06wITVe7eFSCD5G4NRRICzWGmWV7N 5OVA== X-Gm-Message-State: AODbwcBq1aIR38UtI86carVtsWMr7IBNeY4ArWHRZVjqhshSwUii5OCD 7tAn+TNAdwOu+UYZ4HdQPJmVkddHALnw X-Received: by 10.202.89.66 with SMTP id n63mr10709416oib.179.1495476800967; Mon, 22 May 2017 11:13:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.29.164 with HTTP; Mon, 22 May 2017 11:13:20 -0700 (PDT) In-Reply-To: <592327E8.3090305@gmx.org> References: <592327E8.3090305@gmx.org> From: RJ Date: Mon, 22 May 2017 14:13:20 -0400 Message-ID: Subject: Re: Simple question.. how to call a java class method in Groovy Script To: users@groovy.apache.org Content-Type: multipart/alternative; boundary="001a113d597c7ddad1055020d36e" archived-at: Mon, 22 May 2017 18:13:28 -0000 --001a113d597c7ddad1055020d36e Content-Type: text/plain; charset="UTF-8" Thanks for the response, Jochen. Tried your suggestion, it doesn't like it: 2017-05-22 14:06:15,871 ERROR - org.codehaus.groovy.runtime.InvokerInvocationException: groovy.lang.MissingMethodException: No signature of method: static com.example.auth.principal.getId() is applicable for argument types: () values: [] Possible solutions: getAt(java.lang.String), wait(), find(), grep(), wait(long), grep(java.lang.Object) We try something like this in Java.. Whats the equivalent in Groovy Script ? import com.example.auth.principal; public String1 abcd(final principal Principal){ return Principal.getId(); } On Mon, May 22, 2017 at 2:03 PM, Jochen Theodorou wrote: > 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> 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 > --001a113d597c7ddad1055020d36e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks for the response, Jochen.=C2=A0 Tried your sug= gestion, it doesn't like it:

2017-05-22 14:06:15,871 ERROR - <= ;groovy.lang.MissingMethodException: No signature of method: static com.exa= mple.auth.principal.getId() is applicable for argument types: () values: []=
Possible solutions: getAt(java.lang.String), wait(), find(), grep(), wa= it(long), grep(java.lang.Object)>
org.codehaus.groovy.runtime.Invoker= InvocationException: groovy.lang.MissingMethodException: No signature of me= thod: static com.example.auth.principal.getId() is applicable for argument = types: () values: []
Possible solutions: getAt(java.lang.String), wait()= , find(), grep(), wait(long), grep(java.lang.Object)

We try somethin= g like this in Java.. Whats the equivalent in Groovy Script ?

= import com.example.auth.principal;
public String1 abcd(final principal P= rincipal){
return Principal.getId();
}

On Mon, May 22, 2017 at 2:03 PM, Joche= n Theodorou <blackdrag@gmx.org> wrote:
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 {
=C2=A0 =C2=A0 =C2=A0def Map<UserString, List<UserObject>> run(f= inal UserObject... args) {
=C2=A0 =C2=A0 =C2=A0def userid=3Dcom.example.auth.user.getId()
=C2=A0 =C2=A0 =C2=A0return [MYLOGINID:userid]
=C2=A0 =C2=A0 =C2=A0}
}

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

bye Jochen

--001a113d597c7ddad1055020d36e--