01: /*
02:
03: This software is OSI Certified Open Source Software.
04: OSI Certified is a certification mark of the Open Source Initiative.
05:
06: The license (Mozilla version 1.0) can be read at the MMBase site.
07: See http://www.MMBase.org/license
08:
09: */
10: package org.mmbase.util.transformers;
11:
12: import java.util.Map;
13:
14: /**
15: * Some Transformers implement more than one transformation. The instance can be configured.
16: *
17: * @author Michiel Meeuwissen
18: * @since MMBase-1.7
19: */
20: public abstract class ConfigurableStringTransformer extends
21: StringTransformer implements ConfigurableTransformer {
22:
23: protected int to;
24:
25: public ConfigurableStringTransformer() {
26: super ();
27: }
28:
29: public ConfigurableStringTransformer(int conf) {
30: super ();
31: configure(conf);
32: }
33:
34: public void configure(int t) {
35: //log.info("Setting config to " + t);
36: to = t;
37: }
38:
39: abstract public Map<String, Config> transformers();
40:
41: abstract public String getEncoding();
42:
43: public String toString() {
44: try {
45: return getEncoding();
46: } catch (Exception e) {
47: return "UNCONFIGURED " + super.toString();
48: }
49: }
50: }
|