Groovy is a dynamic language over a Java Virtual Machine.
So it works every where, where java runs.
The language is a mix between python, ruby and java.
In the example below, I use the same capacity of python to create property and method dynamically
// Download and use gotan @Grab(group='org.tango', module='gotan', version='0.0.1-SNAPSHOT') // Create a new Tango Server with gotan def server = new DeviceServer() server.integer = 20 server.random = { Math.random() } server.randomize() { max -> Math.random(max) } server.start("test/test/test")
In the client part, I use also the dynamic behaviour of groovy to access directly the attribute or command.
// And create a client with gotan def client = new DeviceServerProxy("test/test/test") println client.integer println client.random println client.randomize(100)
The code speaks by itself, isn't it ;-)
It's just a resume of the capacities of groovy.
PS : The Grab command is great solution to reduce deployment.
It downloads modules from an apache maven repository and loads it.
And do you know that a tango java repository exists !!!
Aucun commentaire:
Enregistrer un commentaire