How to define a method in Groovy-Eclipse DSL

140 views Asked by At

I'm developing a language by taking advantages of groovy-eclipse plugin. I can define a property successfully. However, I can not do same even for a simple method. Probably I'm missing some very simple thing at the center of all...

  • Can't I define a method that delegates to a simple closure?
  • What does type property define in a method pointcut?

Following is only contribution block in my groovy dsl file;

 currentType(currentType("com.galaksiya.World")){
     method name : 'sayHello', 
     provider : 'Galaksiya', 
     doc : 'This is a simple salutor.', 
     delegate: {-> println 'Hello World'}
 }

Is it a simple defect or do I need to change my perspective?

1

There are 1 answers

0
Erdem Eser On

OK. I think I see that what is wrong. Concerns are separated. Groovy-Eclipse DSL enables you to manage features like code completion and howers, docs... But it doesn't provide any capability about implementation. You should design and implement your languages artifacts using meta programming features of groovy (like expandos, dynamic closures etc.) separately from your dsl.