Skip to content

Instantly share code, notes, and snippets.

@ppazos
Created August 20, 2016 06:19
Show Gist options
  • Save ppazos/a6047f5a7c54db69f63519b3db5b4847 to your computer and use it in GitHub Desktop.
Save ppazos/a6047f5a7c54db69f63519b3db5b4847 to your computer and use it in GitHub Desktop.
Groovy DSL test
// testing groovy DSL
// http://docs.groovy-lang.org/docs/latest/html/documentation/core-domain-specific-languages.html
COMPOSITION = 'COMPOSITION'
// constructor for patient's stuff
def create( what )
{
[to: { patient ->
switch (what) {
case COMPOSITION:
println 'creating composition for patient '+ patient
[uid:123123, patient: patient]
break
default:
println what +' not supported'
}
}]
}
def c = create COMPOSITION to '12313'
// set data to compo
// save compo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment