01: /* $Id: Format.java 674 2006-10-06 12:15:59Z hengels $ */
02: package org.conform.format;
03:
04: import java.text.ParseException;
05:
06: /**
07: * Generates a formatted string representation of a value and vice versa, parses a string into a value.
08: * @author hengels
09: */
10: public interface Format extends Cloneable {
11: String format(Object value);
12:
13: Object parse(String string) throws ParseException;
14:
15: /**
16: * Many Format implementations use a pattern.
17: * @return the pattern string
18: */
19: String getPattern();
20:
21: /**
22: * Many Format implementations use a pattern.
23: * @param pattern the pattern string
24: */
25: void setPattern(String pattern);
26:
27: /**
28: * The error message code.
29: * @return the message code
30: */
31: String getMessage();
32:
33: /**
34: * A hint for users to get the format right.
35: * @return a help string
36: */
37: String getHelp();
38:
39: /**
40: * Format implementations have to be clonable.
41: */
42: Object clone();
43: }
|