Skip to content

Instantly share code, notes, and snippets.

@robpatrick
robpatrick / CreatedAndLastUpdated.groovy
Created November 3, 2013 12:47
The Grails ORM technology - GORM, has the ability to auto-timestamp GORM objects with the date and time they were created and last updated, details can be found here: http://grails.org/doc/latest/guide/GORM.html#eventsAutoTimestamping Our developers didn't like to have to litter our GORM code with these attributes so I created an AST transformat…
package com.alkalinezoo.transform
import java.lang.annotation.Target
import java.lang.annotation.ElementType
import java.lang.annotation.Retention
import java.lang.annotation.RetentionPolicy
import org.codehaus.groovy.transform.GroovyASTTransformationClass
/**
* Simple annotation that when used on a class adds two new fields of type {@code java.util.Date}
@robpatrick
robpatrick / RomanNumeralGenerator.java
Last active August 29, 2015 14:13
Roman numeral generator - just for fun.
package com.spartacus;
/**
* Interface that defines a method that calculates Roman numerals from a given number.
*
* @author robert.patrick
*/
public interface RomanNumeralGenerator {
String generateNumber( int number );