1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
package org.apache.myfaces.config.impl.digester.elements; |
20 | |
|
21 | |
import javax.faces.context.FacesContext; |
22 | |
import javax.faces.el.ValueBinding; |
23 | |
|
24 | |
import org.apache.myfaces.config.impl.digester.elements.ListEntries; |
25 | |
import org.apache.myfaces.util.ContainerUtils; |
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | 0 | public class ManagedProperty implements org.apache.myfaces.config.element.ManagedProperty |
35 | |
{ |
36 | 0 | private static final ValueBinding DUMMY_VB = new DummyValueBinding(); |
37 | |
|
38 | 0 | private int _type = TYPE_UNKNOWN; |
39 | |
private String _propertyName; |
40 | |
private String _propertyClass; |
41 | |
private ValueBinding _valueBinding; |
42 | |
private String _value; |
43 | |
private MapEntries _mapEntries; |
44 | |
private ListEntries _listEntries; |
45 | |
|
46 | |
public int getType() |
47 | |
{ |
48 | 0 | return _type; |
49 | |
} |
50 | |
|
51 | |
|
52 | |
public org.apache.myfaces.config.element.MapEntries getMapEntries() |
53 | |
{ |
54 | 0 | return _mapEntries; |
55 | |
} |
56 | |
|
57 | |
|
58 | |
public void setMapEntries(MapEntries mapEntries) |
59 | |
{ |
60 | 0 | _mapEntries = mapEntries; |
61 | 0 | _type = TYPE_MAP; |
62 | 0 | } |
63 | |
|
64 | |
|
65 | |
public org.apache.myfaces.config.element.ListEntries getListEntries() |
66 | |
{ |
67 | 0 | return _listEntries; |
68 | |
} |
69 | |
|
70 | |
|
71 | |
public void setListEntries(ListEntries listEntries) |
72 | |
{ |
73 | 0 | _listEntries = listEntries; |
74 | 0 | _type = TYPE_LIST; |
75 | 0 | } |
76 | |
|
77 | |
|
78 | |
public String getPropertyName() |
79 | |
{ |
80 | 0 | return _propertyName; |
81 | |
} |
82 | |
|
83 | |
|
84 | |
public void setPropertyName(String propertyName) |
85 | |
{ |
86 | 0 | _propertyName = propertyName; |
87 | 0 | } |
88 | |
|
89 | |
|
90 | |
public String getPropertyClass() |
91 | |
{ |
92 | 0 | return _propertyClass; |
93 | |
} |
94 | |
|
95 | |
|
96 | |
public void setPropertyClass(String propertyClass) |
97 | |
{ |
98 | 0 | _propertyClass = propertyClass; |
99 | 0 | } |
100 | |
|
101 | |
|
102 | |
public boolean isNullValue() |
103 | |
{ |
104 | 0 | return _type == TYPE_NULL; |
105 | |
} |
106 | |
|
107 | |
|
108 | |
public void setNullValue() |
109 | |
{ |
110 | 0 | _type = TYPE_NULL; |
111 | 0 | } |
112 | |
|
113 | |
|
114 | |
public void setValue(String value) |
115 | |
{ |
116 | 0 | _value = value; |
117 | 0 | _type = TYPE_VALUE; |
118 | 0 | } |
119 | |
|
120 | |
public String getValue() |
121 | |
{ |
122 | 0 | return _value; |
123 | |
} |
124 | |
|
125 | |
|
126 | |
public Object getRuntimeValue(FacesContext facesContext) |
127 | |
{ |
128 | 0 | getValueBinding(facesContext); |
129 | |
|
130 | 0 | return (_valueBinding == DUMMY_VB) |
131 | |
? _value : _valueBinding.getValue(facesContext); |
132 | |
} |
133 | |
|
134 | |
|
135 | |
public ValueBinding getValueBinding(FacesContext facesContext) |
136 | |
{ |
137 | 0 | if (_valueBinding == null) |
138 | |
{ |
139 | 0 | _valueBinding = |
140 | |
isValueReference() |
141 | |
? facesContext.getApplication().createValueBinding(_value) |
142 | |
: DUMMY_VB; |
143 | |
} |
144 | 0 | return _valueBinding; |
145 | |
} |
146 | |
|
147 | |
|
148 | |
public boolean isValueReference() |
149 | |
{ |
150 | 0 | return ContainerUtils.isValueReference(_value); |
151 | |
} |
152 | |
|
153 | |
|
154 | 0 | private static class DummyValueBinding extends ValueBinding |
155 | |
{ |
156 | |
public String getExpressionString() |
157 | |
{ |
158 | 0 | throw new UnsupportedOperationException(); |
159 | |
} |
160 | |
|
161 | |
public Class getType(FacesContext facesContext) |
162 | |
{ |
163 | 0 | throw new UnsupportedOperationException(); |
164 | |
} |
165 | |
|
166 | |
public Object getValue(FacesContext facesContext) |
167 | |
{ |
168 | 0 | throw new UnsupportedOperationException(); |
169 | |
} |
170 | |
|
171 | |
public boolean isReadOnly(FacesContext facesContext) |
172 | |
{ |
173 | 0 | throw new UnsupportedOperationException(); |
174 | |
} |
175 | |
|
176 | |
public void setValue(FacesContext facesContext, Object value) |
177 | |
{ |
178 | 0 | throw new UnsupportedOperationException(); |
179 | |
} |
180 | |
} |
181 | |
} |