Jon Aquino's Mental Garden

Engineering beautiful software jon aquino labs | personal blog

Tuesday, June 08, 2004

stop work 6:31

#!groovy

#This Groovy script expands a specification file (DataConversion.txt)
#into a PL/SQL stored procedure. [Jon Aquino 2004-06-08]

import java.io.*

print "/* This code was generated by DataConversion.groovy [Jon Aquino] */\n"
keywordToExpanderMap = [
"table" : {print "Copy table ${it[0]} to ${it[1]}\n"},
"field" : {print " ${it[0]} => ${it[1]}\n"}
]
new File("DataConversion.txt").eachLine { line |
parameters = line.tokenize(":")[1].tokenize(",")
parameters = parameters.collect { parameter | parameter.trim() }
keywordToExpanderMap[line.tokenize(":")[0]].call(parameters)
}

0 Comments:

Post a Comment

<< Home