1 15 package org.apache.tapestry.test; 16 17 import org.apache.tapestry.enhance.EnhanceUtils; 18 import org.apache.tapestry.enhance.EnhancementOperation; 19 import org.apache.tapestry.enhance.EnhancementWorker; 20 import org.apache.tapestry.spec.IComponentSpecification; 21 22 29 public class CreatePropertyWorker implements EnhancementWorker 30 { 31 private String _propertyName; 32 33 public CreatePropertyWorker(String propertyName) 34 { 35 _propertyName = propertyName; 36 } 37 38 public void performEnhancement(EnhancementOperation op, IComponentSpecification spec) 39 { 40 Class propertyType = EnhanceUtils.extractPropertyType(op, _propertyName, null); 41 42 op.claimProperty(_propertyName); 43 44 String field = "_$" + _propertyName; 45 46 op.addField(field, propertyType); 47 48 EnhanceUtils.createSimpleAccessor(op, field, _propertyName, propertyType); 49 50 EnhanceUtils.createSimpleMutator(op, field, _propertyName, propertyType); 51 } 52 } | Popular Tags |