1 4 package com.tc.config.schema.test; 5 6 import com.tc.config.schema.builder.InstrumentedClassConfigBuilder; 7 8 12 public class InstrumentedClassConfigBuilderImpl extends BaseConfigBuilder implements InstrumentedClassConfigBuilder { 13 14 private boolean isInclude; 15 16 public InstrumentedClassConfigBuilderImpl(Class clazz) { 17 this(); 18 setClassExpression(clazz.getName()); 19 } 20 21 public InstrumentedClassConfigBuilderImpl() { 22 super(4, ALL_PROPERTIES); 23 this.isInclude = true; 24 } 25 26 public void setIsInclude(boolean isInclude) { 27 this.isInclude = isInclude; 28 } 29 30 public void setClassExpression(String value) { 31 if (isInclude) setProperty("class-expression", value); 32 else setProperty("exclude", value); 33 } 34 35 public void setHonorTransient(String value) { 36 setProperty("honor-transient", value); 37 } 38 39 public void setHonorTransient(boolean value) { 40 setProperty("honor-transient", value); 41 } 42 43 public void setCallConstructorOnLoad(String value) { 44 setProperty("call-constructor-on-load", value); 45 } 46 47 public void setCallConstructorOnLoad(boolean value) { 48 setProperty("call-constructor-on-load", value); 49 } 50 51 private static final String [] ALL_PROPERTIES = new String [] { "class-expression", "honor-transient", 52 "call-constructor-on-load", "exclude" }; 53 54 public String toString() { 55 String out = ""; 56 57 if (this.isInclude) { 58 out += indent() + openElement("include"); 59 out += indent() + elements(ALL_PROPERTIES); 60 out += indent() + closeElement("include"); 61 } else { 62 out += indent() + elements(ALL_PROPERTIES); 63 } 64 65 return out; 66 } 67 68 } 69 | Popular Tags |