Groovy
Simple Evaluation of Groovy Expressions in Java
This groovy capability may be enough if what you are looking for involves up to three variables.
We can run Groovy code from Java code in several ways. A very simple and easy way is to use the Eval class. The Eval class has five methods to execute simple Groovy expressions with zero to three arguments. All methods are static and the Groovy expression must be a String.
Using Drools with Groovy and Gradle
Rule-engine is software that executes code described in a certain rule format. The idea is to use high-level descriptive language to encode domain knowledge into a system. Rule-engine systems are however much more than the rule programming language. Systems typically have special tooling, such as repositories where the knowledge is managed and updated to runtime systems. Drools is an open-source rule-engine that you can try and use for free
Moreover, he shows how to use Drools to classify poker hands. The example is so compelling that I ought to do Grails guide with it.
Groovy 3 and 2.6 - Java 8 Lambda example
Until native lambda support comes to Groovy, @tvinke shows how to write them as Closures.
I always had to write the lambdas as closures, which would work since they can be converted into interfaces or single-abstract method (SAM) types. Most of the lamda expressions are build on a Java 8 functional interface, which is a SAM — and Groovy just does automatic closure coercion for us.
Cautionary tale of GStrings as Map keys
Although @anicolaspp lost me in the conclusion, this blog cautions you about one Groovy pitfall.
Documented though; Gstrings and Strings hash codes
GString and Strings having different hashCode values, using GString as Map keys should be avoided, especially if we try to retrieve an associated value with a String instead of a GString.
GORM
Grails Quickcast #9: GORM Many-to-One Relationship - Replacing a Collection
I recently worked in a Github issue which triggered me to record a quickcast about how to replace a many-to-one collection efficiently by using a minimal number of queries or leveraging cascade behavior.
Grails
Training - Modern Grails Development with Grails at Greach
📅 March 13th-March 14th. 12 hours⏳ 📍Madrid, Spain. 50% off for Greach attendees.
Build a Grails app from scratch and learn about best practices and the latest innovation in Grails ecosystem; GORM data services, JSON Views, Multi-tenancy, GraphQL...
Misc
JAVA - Learn Drools Series
These seven-part series explains Drools to get you started in a rule-engine journey.
Comment
This week I have been working in a Grails 3 rule-engine integration for a client. I need to learn a lot but I have found several interesting links. Hopefully, if they help you out too.
Sergio del Amo