KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > config > schema > test > SpringApplicationConfigBuilderImpl


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.config.schema.test;
5
6 import com.tc.config.schema.builder.SpringApplicationConfigBuilder;
7 import com.tc.config.schema.builder.SpringApplicationContextConfigBuilder;
8
9 import java.util.Collections JavaDoc;
10
11 public class SpringApplicationConfigBuilderImpl extends BaseConfigBuilder implements SpringApplicationConfigBuilder {
12
13   private String JavaDoc name;
14
15   protected SpringApplicationConfigBuilderImpl() {
16     super(4, new String JavaDoc[] { "application-contexts" });
17   }
18
19   public static SpringApplicationConfigBuilderImpl newMinimalInstance() {
20     SpringApplicationConfigBuilderImpl result = new SpringApplicationConfigBuilderImpl();
21
22     result.setApplicationContexts(new SpringApplicationContextConfigBuilder[] { SpringApplicationContextConfigBuilderImpl.newMinimalInstance() });
23     return result;
24   }
25
26   public String JavaDoc toString() {
27     return openElement("jee-application", Collections.singletonMap("name", name))
28             + openElement("application-contexts")
29            + propertyAsString("application-contexts")
30            + closeElement("application-contexts")
31            + closeElement("jee-application");
32   }
33
34   public SpringApplicationContextConfigBuilder[] getApplicationContexts() {
35     if (isSet("application-contexts")) return (SpringApplicationContextConfigBuilder[]) ((SelfTaggingArray) getRawProperty("application-contexts"))
36         .values();
37     else return null;
38   }
39
40   public void setApplicationContexts(SpringApplicationContextConfigBuilder[] applications) {
41     setProperty("application-contexts", selfTaggingArray(applications));
42   }
43
44   public void setName(String JavaDoc name) {
45     this.name = name;
46   }
47 }
48
Popular Tags