1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.jxpath.ri.model.dynabeans;
18
19 import java.util.Locale;
20
21 import org.apache.commons.beanutils.LazyDynaBean;
22 import org.apache.commons.beanutils.LazyDynaClass;
23 import org.apache.commons.jxpath.ri.QName;
24 import org.apache.commons.jxpath.ri.model.NodePointer;
25 import org.apache.commons.jxpath.ri.model.NodePointerFactory;
26 import org.apache.commons.jxpath.ri.model.beans.PropertyPointer;
27
28
29
30
31
32
33
34
35
36
37
38 public class StrictLazyDynaBeanPointerFactory implements NodePointerFactory {
39
40
41
42 private static class StrictLazyDynaBeanPointer extends DynaBeanPointer {
43 private static final long serialVersionUID = 1L;
44
45 private final LazyDynaBean lazyDynaBean;
46
47
48
49
50
51
52
53
54 public StrictLazyDynaBeanPointer(NodePointer parent, QName name, LazyDynaBean lazyDynaBean) {
55 super(parent, name, lazyDynaBean);
56 this.lazyDynaBean = lazyDynaBean;
57 }
58
59
60
61
62
63
64
65
66 public StrictLazyDynaBeanPointer(QName name, LazyDynaBean lazyDynaBean, Locale locale) {
67 super(name, lazyDynaBean, locale);
68 this.lazyDynaBean = lazyDynaBean;
69 }
70
71
72
73
74 public PropertyPointer getPropertyPointer() {
75 return new DynaBeanPropertyPointer(this, lazyDynaBean) {
76 private static final long serialVersionUID = 1L;
77
78 protected boolean isActualProperty() {
79 return ((LazyDynaClass) lazyDynaBean.getDynaClass())
80 .isDynaProperty(getPropertyName());
81 }
82 };
83 }
84 }
85
86
87
88
89 public int getOrder() {
90 return DynaBeanPointerFactory.DYNA_BEAN_POINTER_FACTORY_ORDER - 1;
91 }
92
93
94
95
96 public NodePointer createNodePointer(QName name, Object object, Locale locale) {
97 return object instanceof LazyDynaBean ? new StrictLazyDynaBeanPointer(name,
98 (LazyDynaBean) object, locale) : null;
99 }
100
101
102
103
104 public NodePointer createNodePointer(NodePointer parent, QName name, Object object) {
105 return object instanceof LazyDynaBean ? new StrictLazyDynaBeanPointer(parent, name,
106 (LazyDynaBean) object) : null;
107 }
108
109 }