Here are some larger examples of DSLDs. All scripts here are available under an EPL license:
This DSLD handles the
@Delegate AST transform through a call to
This shows how
@Singleton is implemented. We need to explicitly use a bind pointcut here since we want to bind to the outermost pointcut.
The code for
@Mixin looks like this:
Although this next example is quite long, it is fairly straight forward. We are just adding lots and lots and lots of methods to the
SwingBuilder class. This script is only partially complete since we don't include documentation for all contributed methods. It might be possible to use
BeanInfo to generate this script automatically.
DSLD Meta Script
Finally, here is the script that defines editing support for DSLDs themselves. A few comments:
- Notice the use of
wormholeto store the declaration of binding names so that they can appear in content assist later.
- We are accessing the
org.codehaus.groovy.eclipse.dsl.script.PointcutFactory, which is a class defined inside of Groovy-Eclipse where all of the pointcuts are registered. Doing this ensures thatthe list of pointcuts in the