equal
deleted
inserted
replaced
32 */ |
32 */ |
33 public class FormatterDefinition implements NameIdentified { |
33 public class FormatterDefinition implements NameIdentified { |
34 |
34 |
35 private String name; |
35 private String name; |
36 private String className; |
36 private String className; |
|
37 private Properties properties = new Properties(); |
37 |
38 |
38 public FormatterDefinition() { |
39 public FormatterDefinition() { |
39 } |
40 } |
40 |
41 |
41 public FormatterDefinition(String name, String className) { |
42 public FormatterDefinition(String name, String className) { |
42 this.name = name; |
43 this.name = name; |
43 this.className = className; |
44 this.className = className; |
|
45 } |
|
46 |
|
47 public FormatterDefinition(String name, String className, Properties properties) { |
|
48 this(name, className); |
|
49 this.properties = properties; |
44 } |
50 } |
45 |
51 |
46 @XmlElement(name = "name", namespace = CONFIGURATION) |
52 @XmlElement(name = "name", namespace = CONFIGURATION) |
47 @Override |
53 @Override |
48 public String getName() { |
54 public String getName() { |
70 |
76 |
71 public void setClassName(String className) { |
77 public void setClassName(String className) { |
72 this.className = className; |
78 this.className = className; |
73 } |
79 } |
74 |
80 |
|
81 @XmlElement(name = "property", namespace = CONFIGURATION) |
|
82 public Properties getProperties() { |
|
83 return properties; |
|
84 } |
|
85 |
|
86 public void setProperties(Properties properties) { |
|
87 this.properties = properties; |
|
88 } |
|
89 |
75 /** |
90 /** |
76 * @param context |
91 * @param context |
77 * @return |
92 * @return |
78 * @throws DKException |
93 * @throws DKException |
79 */ |
94 */ |
80 public Formatter getInstance(FormatterContext context) throws FormatterException { |
95 public Formatter getInstance(FormatterContext context) throws FormatterException { |
|
96 context.getProperties().setDefaults(properties); |
81 try { |
97 try { |
82 Constructor constructor = Class.forName(className).getConstructor(context.getClass()); |
98 Constructor constructor = Class.forName(className).getConstructor(context.getClass()); |
83 |
99 |
84 Object instance = constructor.newInstance(context); |
100 Object instance = constructor.newInstance(context); |
85 if (instance instanceof Formatter) { |
101 if (instance instanceof Formatter) { |