englishteeth.co.uk

… the weblog of Ian “English Teeth” Robinson
  • rss
  • Home

Groovy

Ian | March 31, 2008

So I can now say that I’ve had my first real project exposure to groovy!

Groovy

In this instance it was occupying the space where AWK or SED scripts might have been found in the past. It seems to sit quite naturally here; extending what you might want to do from an ANT script in a consistent/familiar syntax.

It could do much more, pretty much whatever Java can, though I’m not sure I’d be comfortable extending it’s project footprint too much.

Personally, I like the in built mark-up support… (But I’m funny that way.)

import groovy.xml.MarkupBuilder

def myXMLDoc = new MarkupBuilder();

    myXMLDoc.customer {
    	title(id:"001", "Mr");
    	forename("New");
    	surname("Customer");
    	address(type:"home"){
    		number("295");
    		addressLineOne("Fictitious Road");
    		addressLineTwo("");
    		town("Fake Town");
    		county("Notashire");
    		postCode("NO1 5NA");
    	}
    }

The above, in what seems to be a convenient and concise format, gives the following structure:

<customer>
   <title id='001'>Mr</title>
   <forename>New</forename>
   <surname>Customer</surname>
   <address type='home'>
     <number>295</number>
     <addressLineOne>Fictitious Road</addressLineOne>
     <addressLineTwo></addressLineTwo>
     <town>Fake Town</town>
     <county>Notashire</county>
     <postCode>NO1 5NA</postCode>
   </address>
</customer>

Whether this is truly useful or just an interesting diversion remains to be seen, at least for me. But, this is a great deal more workable than native Java alternatives.

The homepage for groovy can be found here and a first contact introduction to it can be found here.

Categories
development
Tags
groovy, java, xml
Comments rss
Comments rss
Trackback
Trackback

« Messing about on the water Site Updates »

Leave a comment

You can use these tags : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Author

Ian Robinson is a relatively agile software engineer interested in things both sides of the object relational divide and beyond.

Categories

  • development (37)
  • miscellaneous (28)
  • music (7)
  • software (19)

What I'm Doing...

  • @noelfielding11 why are you in watching telly!? in reply to noelfielding11 2010-04-16
  • What was so good about Nick Drake? These "artists" are covering, music is spot on but no effect at all. Totally lacking the goose pimples. 2010-04-16
  • Some Ginger bloke's on telly covering Nick Drake in a mediocre style. 2010-04-16
  • More updates...

Posting tweet...

Powered by Twitter Tools.

Blogroll

  • Dan North
  • Dave Astels
  • Dave Wood
  • eirikso.com
  • Matt Raible
  • Object Mentor Blog
  • The Ancient Art of Programming
  • The Wisdom of Ganesh

Tags

active-mq architecture bauhaus css db eclipse esb festivals freesat gorm grails groovy hd hibernate htpc java jboss jms junit links mce media center mini music oracle osgi patterns pirsig plugins satellite soa software spring sql struts2 testing themes tools tv vmc web wordpress xml xpath xslt
rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox