01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.tc.config.schema.test;
06:
07: import com.tc.config.schema.builder.RootConfigBuilder;
08:
09: /**
10: * Allows you to build valid config for a root. This class <strong>MUST NOT</strong> invoke the actual XML beans to do
11: * its work; one of its purposes is, in fact, to test that those beans are set up correctly.
12: */
13: public class RootConfigBuilderImpl extends BaseConfigBuilder implements
14: RootConfigBuilder {
15:
16: public RootConfigBuilderImpl(Class clazz, String field) {
17: this ();
18: setFieldName(clazz.getName() + "." + field);
19: }
20:
21: public RootConfigBuilderImpl(Class clazz, String fieldName,
22: String rootName) {
23: this ();
24: setFieldName(clazz.getName() + "." + fieldName);
25: setRootName(rootName);
26: }
27:
28: public RootConfigBuilderImpl() {
29: super (4, ALL_PROPERTIES);
30: }
31:
32: public void setFieldName(String name) {
33: setProperty("field-name", name);
34: }
35:
36: public void setRootName(String name) {
37: setProperty("root-name", name);
38: }
39:
40: private static final String[] ALL_PROPERTIES = new String[] {
41: "field-name", "root-name" };
42:
43: public String toString() {
44: return elements(ALL_PROPERTIES);
45: }
46:
47: }
|