1 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 ; 10 11 public class SpringApplicationConfigBuilderImpl extends BaseConfigBuilder implements SpringApplicationConfigBuilder { 12 13 private String name; 14 15 protected SpringApplicationConfigBuilderImpl() { 16 super(4, new String [] { "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 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 name) { 45 this.name = name; 46 } 47 } 48 | Popular Tags |