// this will actually be a Java class class JSONObject { def properties = [ : ]; public void set(String name, Object value) { properties[name] = value; } public Object get(String name) { return properties[name]; } } class JSONCategory { static Object getProperty(JSONObject json, String name) { return json.get(name); } static Object setProperty(JSONObject json, String name, Object value) { return json.set(name, value); } } use(JSONCategory) { def message = new JSONObject(); message.name = 'cameron'; println message.name }