1 4 package com.tc.config.schema.test; 5 6 import com.tc.config.schema.builder.LockConfigBuilder; 7 import com.tc.util.Assert; 8 9 13 public class LockConfigBuilderImpl extends BaseConfigBuilder implements LockConfigBuilder { 14 15 private final String tag; 16 17 public LockConfigBuilderImpl(String tag, Class clazz, String lockLevel) { 18 this(tag); 19 setMethodExpression("* " + clazz.getName() + ".*(..)"); 20 setLockLevel(lockLevel); 21 } 22 23 public LockConfigBuilderImpl(String tag) { 24 super(4, ALL_PROPERTIES); 25 26 Assert.assertNotBlank(tag); 27 this.tag = tag; 28 } 29 30 public void setLockName(String value) { 31 setProperty("lock-name", value); 32 } 33 34 public void setMethodExpression(String value) { 35 setProperty("method-expression", value); 36 } 37 38 public void setLockLevel(String value) { 39 setProperty("lock-level", value); 40 } 41 42 public void setLockName(int value) { 43 setProperty("lock-name", value); 44 } 45 46 private static final String [] ALL_PROPERTIES = new String [] { "lock-name", "method-expression", "lock-level" }; 47 48 public String toString() { 49 return openElement(this.tag) + elements(ALL_PROPERTIES) + closeElement(this.tag); 50 } 51 52 } 53 | Popular Tags |