01: package uk.org.ponder.conversion;
02:
03: /** A minimal interface which expresses the conversion of simple (leaf,
04: * non-composite) objects to and from a String representation.
05: */
06:
07: public interface LeafObjectParser {
08: /** Parses a leaf object (i.e. one which is not composite) from a String
09: * representation.
10: * @param toparse The putative leaf data to be parsed.
11: * @return The successfully parsed object.
12: */
13: Object parse(String toparse);
14:
15: /** The DeSAXalizer calls this method when it wishes to render a leaf node
16: * object into textual form.
17: * @param torender The object to be rendered.
18: * @return A String holding the rendered text.
19: */
20: String render(Object torender);
21:
22: /** Clones an object by returning an equivalent object which shares no
23: * state with the original. For most leaf objects simply returns the original
24: * if they are known to be immutable.
25: * <p>This method is useful since the JDK Object.clone() method is not only
26: * vastly inefficient (costing around a microsecond per throw) but also
27: * greatly intrusive.
28: */
29: public Object copy(Object tocopy);
30: }
|