1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.commons.clazz.reflect.common;
17
18 import org.apache.commons.clazz.reflect.ReflectedClazz;
19
20
21
22
23
24
25
26
27 public class ReflectedScalarPropertyParseResults
28 extends ReflectedPropertyParseResults
29 {
30
31
32
33 public ReflectedScalarPropertyParseResults(
34 ReflectedClazz clazz, String propertyName)
35 {
36 super(clazz, propertyName);
37 }
38
39 protected String getPropertyCategory() {
40 return "scalar";
41 }
42
43 public boolean checkConsistency() {
44 if (!super.checkConsistency()) {
45 return false;
46 }
47
48 if (readMethodParseResults == null) {
49 return false;
50 }
51
52 Class type = readMethodParseResults.getType();
53 if (writeMethodParseResults != null) {
54 if (!type.equals(writeMethodParseResults.getType())) {
55 return false;
56 }
57 }
58 return true;
59 }
60
61 protected boolean appendInconsistencyDescriptions(StringBuffer buffer) {
62 if (!super.appendInconsistencyDescriptions(buffer)) {
63 return false;
64 }
65
66 if (readMethodParseResults == null) {
67 buffer.append("\n - Does not have a get() method");
68 return true;
69 }
70
71 Class type = readMethodParseResults.getType();
72 if (writeMethodParseResults != null) {
73 if (!type.equals(writeMethodParseResults.getType())) {
74 buffer.append("\n - Get() and set(v) types do not match");
75 }
76 }
77 return true;
78 }
79 }