1 15 package org.apache.tapestry.bean; 16 17 import org.apache.hivemind.ApplicationRuntimeException; 18 import org.apache.hivemind.impl.BaseLocatable; 19 import org.apache.hivemind.util.PropertyUtils; 20 import org.apache.tapestry.Tapestry; 21 22 28 29 abstract public class AbstractBeanInitializer extends BaseLocatable implements IBeanInitializer 30 { 31 protected String _propertyName; 32 33 public String getPropertyName() 34 { 35 return _propertyName; 36 } 37 38 39 40 public void setPropertyName(String propertyName) 41 { 42 _propertyName = propertyName; 43 } 44 45 protected void setBeanProperty(Object bean, Object value) 46 { 47 try 48 { 49 PropertyUtils.write(bean, _propertyName, value); 50 } 51 catch (ApplicationRuntimeException ex) 52 { 53 String message = Tapestry.format( 54 "AbstractBeanInitializer.unable-to-set-property", 55 _propertyName, 56 bean, 57 value); 58 59 throw new ApplicationRuntimeException(message, getLocation(), ex); 60 } 61 62 } 63 } | Popular Tags |