1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| |
8 |
| |
9 |
| |
10 |
| |
11 |
| |
12 |
| |
13 |
| |
14 |
| |
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 |
| |
23 |
| |
24 |
| |
25 |
| |
26 |
| |
27 |
| |
28 |
| |
29 |
| abstract public class AbstractBeanInitializer extends BaseLocatable implements IBeanInitializer |
30 |
| { |
31 |
| protected String _propertyName; |
32 |
| |
33 |
5
| public String getPropertyName()
|
34 |
| { |
35 |
5
| return _propertyName;
|
36 |
| } |
37 |
| |
38 |
| |
39 |
| |
40 |
7
| public void setPropertyName(String propertyName)
|
41 |
| { |
42 |
7
| _propertyName = propertyName;
|
43 |
| } |
44 |
| |
45 |
0
| protected void setBeanProperty(Object bean, Object value)
|
46 |
| { |
47 |
0
| try
|
48 |
| { |
49 |
0
| PropertyUtils.write(bean, _propertyName, value);
|
50 |
| } |
51 |
| catch (ApplicationRuntimeException ex) |
52 |
| { |
53 |
0
| String message = Tapestry.format(
|
54 |
| "AbstractBeanInitializer.unable-to-set-property", |
55 |
| _propertyName, |
56 |
| bean, |
57 |
| value); |
58 |
| |
59 |
0
| throw new ApplicationRuntimeException(message, getLocation(), ex);
|
60 |
| } |
61 |
| |
62 |
| } |
63 |
| } |