Groovy
Extension Modules
If you ever heard about Extension modules and wonder what are they, this definition by @mrhaki will clarify:
An extension module is a JAR file with classes that provide extra methods to existing other classes like in the JDK or third-party libraries.
Visit the link and discover how to make your Strings talk like a pirate ☠️
Taking advantage of groovy annotations
In his latest G3Summit talk, @ilopmar invites you to discover transformations to assist you with:
- Code generation
- Class design
- Logging Improvements
- Declarative Concurrency
- Cloning and externalising
- Safe scripting
- Compiler directives
- Dependencies handling
In this github repository he has an example of a local AST.
@ilopmar gave a similar talk in GreachConf in 2015. Checkout the video of AST Groovy Transformers: More than meets the eye!
Cocktail: Local AST, Traits and Extension module; the RaffleService
On Tuesday I was in Madrid Groovy User Group Meetup to attend @marioggar talk about ASTs. We surprised us with this mind-blowing microservice which combines Local AST, Traits and an extension module. Wow!
SPANISH: The talk video is already on Youtube. Jump straight to the RaffleService explanation.
Asteroid: A set of utilities to create Groovy AST transformations
As part of @marioggar talk he introduced us to Asteroid:
Asteroid is a set of utilities to make it easier to develop Groovy AST transformations.
He showed us the library in action and how it removes verbosity.
Checkout the Github Repository
Grails
Grails Domain Classes and Enums
@coderberry shows how easy it is to use enum in domain class properties.
Use enums instead of static int values to represent states in domain classes.
Grails enum custom database value mapping
By default, enums will be mapped with their string value. You can change the enumType:
enumType (optional) - The enum type in for type-safe Enum properties. Either ordinal or string.
Tomasz Przybysz explains you in this linked blog post how to do it.
Comment
Are you working with Grails Domain classes and Enum? This issue contains two links which may help you.
Do you want to learn how to leverage the Groovy Annotations? or maybe create your own. This issue will get you there.
Groovy Calamari