Grails

Dealing with immutable collections in Java

Perhaps, you know it before or just skipped it after going through Java API. But I really found it very helpful at this point.   Recently, I had a requirement in an open-source project, where users can iterate through the objects saved in collections (esp. List). But the problem was, we really didn’t want users to directly or...

by Salil
Tag: Java
11-Apr-2012

Grails

Grails: Dynamically create instance of a POGO class

Hi guys, Recently on a project, I was creating a number of command objects to accept incoming parameters from a POST call from an iPhone with which I needed to sync data. I created a parent class for all command object classes to accept the common properties and created individual command object classes to accept any additional...

by Roni C Thomas
Tag: Java
15-Jun-2011

Grails

Groovy: Sort list of objects on the basis of more than one field

Usually, when we deal with databases, we don't face such kind of situation because we query database to get result-set in required order. But let's say you have a List of objects that you want to sort on the basis of two fields. Let's discuss it with an example. I have a list of Tasks (with date and priority fields). I want to sort...

by Salil
Tag: Java
25-Jan-2011

Grails

Encode Content to MD5 Using GROOVY or GRAILS – with Webhook example

Recently I was working on webhooks (which are getting quite popular for sending notifications to other applications using HTTP POST methods). MD5 encoded content is heavily used in webhooks for security concern. My purpose of writing this blog is neither to explain MD5 nor webhooks. But just to show you - 1. a quicker way in...

by Salil
Tag: Java
12-Nov-2010