01: /*
02: * Created on Sep 22, 2004
03: */
04: package uk.org.ponder.conversion;
05:
06: import uk.org.ponder.util.UniversalRuntimeException;
07:
08: /**
09: * @author Antranig Basman (antranig@caret.cam.ac.uk)
10: *
11: */
12: public class ClassParser implements LeafObjectParser {
13: public Object parse(String toparse) {
14: Class togo;
15: try {
16: togo = Class.forName(toparse);
17: } catch (ClassNotFoundException cnfe) {
18: throw UniversalRuntimeException.accumulate(cnfe, "Class "
19: + toparse + " could not be loaded");
20: }
21: return togo;
22: }
23:
24: public String render(Object torendero) {
25: return ((Class) torendero).getName();
26: }
27:
28: public Object copy(Object tocopy) {
29: return tocopy;
30: }
31:
32: }
|