01: package jaxx.introspection;
02:
03: import java.util.*;
04:
05: import jaxx.reflect.*;
06:
07: /** Mirrors the class <code>java.beans.FeatureDescriptor</code>. JAXX uses its own introspector rather than the built-in
08: * <code>java.beans.Introspector</code> so that it can introspect {@link jaxx.reflect.ClassDescriptor},
09: * not just <code>java.lang.Class</code>.
10: */
11: public class JAXXFeatureDescriptor {
12: private String name;
13: private Map/*<String, Object>*/values;
14: private ClassDescriptor classDescriptor;
15:
16: JAXXFeatureDescriptor(ClassDescriptor classDescriptor, String name) {
17: if (name == null || classDescriptor == null)
18: throw new NullPointerException();
19: this .name = name;
20: this .classDescriptor = classDescriptor;
21: }
22:
23: public String getName() {
24: return name;
25: }
26:
27: public ClassDescriptor getClassDescriptor() {
28: return classDescriptor;
29: }
30:
31: public Object getValue(String key) {
32: return values != null ? values.get(key) : null;
33: }
34:
35: public void setValue(String key, Object value) {
36: if (values == null)
37: values = new HashMap/*<String, Object>*/();
38: values.put(key, value);
39: }
40:
41: public static String capitalize(String name) {
42: if (name.length() == 0)
43: return name;
44: else
45: return Character.toUpperCase(name.charAt(0))
46: + name.substring(1);
47: }
48: }
|