01: /* $Id: AbstractFormat.java 722 2006-10-30 10:15:22Z hengels $ */
02: package org.conform.format;
03:
04: import java.text.*;
05: import java.io.Serializable;
06:
07: /**
08: * @version $Revision: 722 $
09: */
10: public abstract class AbstractFormat implements Format, Serializable {
11: protected String message;
12: protected String help;
13: protected String pattern;
14:
15: public String getMessage() {
16: return message;
17: }
18:
19: public void setMessage(String message) {
20: this .message = message;
21: }
22:
23: public String getHelp() {
24: return help;
25: }
26:
27: public void setHelp(String help) {
28: this .help = help;
29: }
30:
31: public String getPattern() {
32: return pattern;
33: }
34:
35: public void setPattern(String pattern) {
36: this .pattern = pattern;
37: }
38:
39: public Object parse(String string) throws ParseException {
40: return null;
41: }
42:
43: public String toString() {
44: String name = getClass().getName();
45: int pos = name.lastIndexOf('.');
46: if (pos != -1)
47: name = name.substring(pos + 1);
48: if (name.endsWith("Format"))
49: name = name.substring(0, name.length() - "Format".length());
50: String pattern = getPattern();
51: return pattern != null ? name + ": " + pattern : name;
52: }
53:
54: public Object clone() {
55: try {
56: return super .clone();
57: } catch (CloneNotSupportedException e) {
58: throw new RuntimeException(e);
59: }
60: }
61: }
|