Groovy Language enhancements that help with Regex Slashy Strings is the first thing that comes to my mind while talking about regex in Groovy. They are a simpler way to represent regex patterns as String compared to their Java counterparts. If we have to find all numbers in a String we can do something like this in Java [code] ...
A very basic migration flow looks as follows: In this scenario, you have a CMS(that could be Sitecore, Drupal, Wordpress or any other CMS) which has source content that needs to be migrated to AEM. To achieve this, we typically need to do following things: Get content from source CMS in any format(XML, CSV, etc) Process this...
Have you ever wondered how come your Collection is being updated and ended up spending time on debugging? We are going to see how can we get to know immediately if our Collection is altered. In this blog, we will do this using ObservableList for 'List' and same can be applied for Map and Set as well. Here goes code to implement this : ...
Groovy is an expressive language, that is what we are going to talk about making the usage of "with" method for specifying closure delegate and making our code more succinct (brief and clearly expressed). In my recent project, I was writing a code to resolve tenant and setting some properties to object tenant. ...
Groovy 2.4 was released in January 2015, with native support for Android development. It allows to write Android applications fully using Groovy. Running Groovy on Android Step 1: Create a new Android project in Android Studio Step 2: Open this build.gradle (Module: app) file: Insert the following code before the first line: ...
Dealing with collections is a part of a Developer’s daily life. However, sometimes it becomes quite cumbersome when we have to iterate through each collection every time we want a manipulated Collection. Ever thought of a groovier way to manipulate a collection and get a Map in a single line? Well, multiple iterations to convert a...
Day 2 at GR8Conf EU June 2015 Copenhagen, Denmark continued to beintriguing and fun filled. The Day started with the keynote from Jeff Scott Brown on Grails and its future plan. He shed light on Grails 3.0 features and its releases plans. He also asked for contribution to migrating plugins from Grails 2.x to Grails 3.0. In his...
The day one at GR8Conf EU June 2015 Copenhagen, Denmark was really awesome. It started at the IT-University with a jam packed hall full of eager registrants with a welcome note from Søren with a history of how the Gr8 conf started. Then, Gulliame went through the state of affairs around Groovy & Grails and addressed the...
In some cases we need mechanism to provide compilation of groovy script at runtime. But at the same time we need to make sure it doesn't consume the JVM to perform compilation every time when we try to access that script. Hence to perform this we need to do the following task : Compile Groovy Script at Runtime. Cache the compiled...
I recently had a situation where I had the exact same criteria in multiple domains. I found a way to DRY them using Closure.delegate. I wanted to share that in this post. Just including the relevant details the domains that I had were like the following. [code language="groovy"]class Subscription { static belongsTo = [topic:...
...
This one is for a particular use case, so lets come straight out to the point. We start with the obvious first: Problem Statement: To track the traffic of a public page from your application. User Story: The current system needs to add a feature that would enable the end user to use your product to track the traffic on his...