> On May 22, 2017, at 2:13 PM, RJ <[email protected]> wrote:
>
> Thanks for the response, Jochen. Tried your suggestion, it doesn't like it:
>
> 2017-05-22 14:06:15,871 ERROR - <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)>
> 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)
Is the class name Principal or principal? Also, what IDE are you using? Any
decent IDE should be able to show you the available method signatures and do
auto-completion for you.
>
> We try something like this in Java.. Whats the equivalent in Groovy Script ?
Whenever in doubt just use the Java syntax. Apart from some Java 8 stuff
(coming soon), Groovy is perfectly happy with Java syntax. Once the code is
working then you can worry about making it more "Groovy"
Cheers,
Keith
>
> 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 <[email protected]
> <mailto:[email protected]>> wrote:
> On 22.05.2017 19 <tel:22.05.2017%2019>: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
>
----------------------
Keith Suderman
Research Associate
Department of Computer Science
Vassar College, Poughkeepsie NY
[email protected]