Reputation: 1
Executing (in console) from a grails project:
import vine.*
import grails.converters.JSON
s = Stem.makeStem([name: "nameValue", description: "Description value"], "24601")
println s as JSON
Generates:
groovy.lang.MissingMethodException: No signature of method: vine.Stem.makeStem() is applicable for argument types: (java.util.LinkedHashMap, java.lang.String) values: [[name:nameValue, description:Description value], BR-459] Possible solutions: makeStem(java.util.LinkedHashMap, java.lang.String) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.springsource.loaded.ri.ReflectiveInterceptor.jlrConstructorNewInstance(ReflectiveInterceptor.java:1075) at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83) at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
The method definition:
def makeStem( LinkedHashMap h, String owner)
{
def s
if ( h.name && h.description ) {
s = new Stem(h)
def ra = new RoleAssignment(peoples: owner)
s.addRole(ra)
}
return s
}
I originally had the def with Map h, but that didn't work either.
Any ideas?
Upvotes: 0
Views: 2467
Reputation: 1442
Assuming that Stem is a service class.
You can do the following in Grails console
import vine.*
import grails.converters.JSON
def stem= ctx.stem
s = stem.makeStem([name: "nameValue", description: "Description value"], "24601")
println s as JSON
Assuming Stem is a domain class,
static makeStem( LinkedHashMap h, String owner) // convert it to a static method
{
...
}
Upvotes: 1