01: /*
02: * Created on Jun 2, 2006
03: */
04: package uk.org.ponder.saxalizer;
05:
06: import uk.org.ponder.beanutil.BeanLocator;
07: import uk.org.ponder.beanutil.WriteableBeanLocator;
08:
09: public class WBLAccessMethod implements AccessMethod {
10: private String propname;
11: private Class clazz;
12:
13: public WBLAccessMethod(Class targetClass, String propname) {
14: this .propname = propname;
15: this .clazz = targetClass;
16: }
17:
18: public String getPropertyName() {
19: return propname;
20: }
21:
22: public Object getChildObject(Object parent) {
23: return ((BeanLocator) parent).locateBean(propname);
24: }
25:
26: public void setChildObject(Object parent, Object newchild) {
27: ((WriteableBeanLocator) parent).set(propname, newchild);
28: }
29:
30: public boolean canGet() {
31: return true;
32: }
33:
34: public boolean canSet() {
35: return true;
36: }
37:
38: public boolean isEnumeration() {
39: return false;
40: }
41:
42: public boolean isDenumerable() {
43: return false;
44: }
45:
46: public Class getAccessedType() {
47: return Object.class;
48: }
49:
50: public Class getDeclaredType() {
51: return Object.class;
52: }
53:
54: public Class getDeclaringClass() {
55: return clazz;
56: }
57:
58: }
|