1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package javax.faces.component;
20
21 import java.beans.PropertyDescriptor;
22 import java.lang.ref.Reference;
23 import java.lang.ref.SoftReference;
24 import java.lang.reflect.Method;
25
26 class _PropertyDescriptorHolder
27 {
28 private final PropertyDescriptor _descriptor;
29 private Reference<Method> _readMethodRef;
30 private Reference<Method> _writeMethodRef;
31
32 public _PropertyDescriptorHolder(PropertyDescriptor descriptor)
33 {
34 _descriptor = descriptor;
35 _readMethodRef = new SoftReference<Method>(_descriptor.getReadMethod());
36 }
37
38 public _PropertyDescriptorHolder(PropertyDescriptor descriptor, Method readMethod)
39 {
40 _descriptor = descriptor;
41 _readMethodRef = new SoftReference<Method>(readMethod);
42 }
43
44 public String getName()
45 {
46 return _descriptor.getName();
47 }
48
49 public Method getReadMethod()
50 {
51 Method readMethod = _readMethodRef.get();
52 if (readMethod == null)
53 {
54 readMethod = _descriptor.getReadMethod();
55 _readMethodRef = new SoftReference<Method>(readMethod);
56 }
57 return readMethod;
58 }
59
60 public Method getWriteMethod()
61 {
62 if (_writeMethodRef == null || _writeMethodRef.get() == null)
63 {
64
65
66
67
68
69 Method writeMethod = _descriptor.getWriteMethod();
70 _writeMethodRef = new SoftReference<Method>(writeMethod);
71 }
72 return _writeMethodRef.get();
73 }
74
75 public PropertyDescriptor getPropertyDescriptor()
76 {
77 return _descriptor;
78 }
79 }