- enums
- annotations
- generics
- groovy interactive shell
- updates to the groovy console
Groovy is Java, and Groovy makes Java groovier. Compared with other languages, Groovy is certainly the language that provides the flattest learning curve to Java developers, thanks to a very similar syntax.I would add that ex-java programmers that have moved to ruby will love groovy. Closures, interactive shell, access to all your current java libraries, built in ORM, and lots of other goodies.
Here is a sample of how I use groovy to read job logs. Jobs run nightly on Sun production servers...
import groovy.sql.Sql
import database.*
oracle = new Oracle()
today = oracle.timestamp(new Date() - 1)
db = oracle.getStarsProd()
sql = "select * from job_log where start_time > ? order by job_id" db.eachRow(sql, [ today ]) {job ->
print "$job.job_id $job.start_time $job.end_time"
println "\t$job.row_count\t$job.error_count\t$job.job_name"
}
This simple script dumps jobs run in the current day. The database package is a collection of groovy scripts that contain oracle specific connections and utilities. More on the specifics of what's in that package in another post...
No comments:
Post a Comment