I started learning Groovy in the past few days. So far I am wondering why I waited so long to start learning it. I like the shorthand style and the ability to get tasks that are a pain in Java done quickly. These are obvious things to like certainly since they are objectives of the language.
Anyhow, I needed something to do with the language so I chose to write a simple script to download a list of public notebooks from Google Notebook and then process the first one in the list. Here are some observations on the process.
import com.google.gdata.client.*;
import com.google.gdata.data.*;
def myId = 'big number from google url'
def urlUser = "http://www.google.com/notebook/feeds/$myId"
URL feedUrl = new URL(urlUser);
GoogleService googleService = new GoogleService("notebook", "alex sample");
/**
* request the feed
*/
Feed myFeed = googleService.getFeed(feedUrl, Feed.class);
print 'notebook name: '
println myFeed.title.plainText;
List l = myFeed.entries;
println "public notebook's: "
for (Entry e in l) {
print e.title.plainText;
URL notebookUrl = new URL(e.id)
Feed notebookFeed = googleService.getFeed(notebookUrl, Feed.class);
/* process the feed */
}