import groovy.transform.* @ToString class MyClass { String first String last } def map = [first: 'f', last: 'l'] // instantiate from literal class reference println new MyClass(map) println MyClass.newInstance(map) println (map as MyClass) println map.asType(MyClass) // instantiate from a variable reference the class def clazz = MyClass println map.asType(clazz) // println (map as clazz) // 'as' operator doesn't like 'clazz' variable println clazz.newInstance(map)