All pastes #93841 Raw Edit

Miscellany

public text v1 · immutable
#93841 ·published 2006-07-20 20:15 UTC
rendered paste body
// this will actually be a Java class that someone else has already written
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
}