Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ReflectedScalarPropertyParseResults |
|
| 4.25;4.25 |
1 | /* | |
2 | * Copyright 2002-2004 The Apache Software Foundation | |
3 | * | |
4 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
5 | * you may not use this file except in compliance with the License. | |
6 | * You may obtain a copy of the License at | |
7 | * | |
8 | * http://www.apache.org/licenses/LICENSE-2.0 | |
9 | * | |
10 | * Unless required by applicable law or agreed to in writing, software | |
11 | * distributed under the License is distributed on an "AS IS" BASIS, | |
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 | * See the License for the specific language governing permissions and | |
14 | * limitations under the License. | |
15 | */ | |
16 | package org.apache.commons.clazz.reflect.common; | |
17 | ||
18 | import org.apache.commons.clazz.reflect.ReflectedClazz; | |
19 | ||
20 | /** | |
21 | * Holds parse results for individual accessor methods for a | |
22 | * scalar property. | |
23 | * | |
24 | * @author <a href="mailto:dmitri@apache.org">Dmitri Plotnikov</a> | |
25 | * @version $Id: ReflectedScalarPropertyParseResults.java 155436 2005-02-26 13:17:48Z dirkv $ | |
26 | */ | |
27 | public class ReflectedScalarPropertyParseResults | |
28 | extends ReflectedPropertyParseResults | |
29 | { | |
30 | /** | |
31 | * Constructor for ReflectedScalarPropertyParseResults. | |
32 | */ | |
33 | public ReflectedScalarPropertyParseResults( | |
34 | ReflectedClazz clazz, String propertyName) | |
35 | { | |
36 | 0 | super(clazz, propertyName); |
37 | 0 | } |
38 | ||
39 | protected String getPropertyCategory() { | |
40 | 0 | return "scalar"; |
41 | } | |
42 | ||
43 | public boolean checkConsistency() { | |
44 | 0 | if (!super.checkConsistency()) { |
45 | 0 | return false; |
46 | } | |
47 | ||
48 | 0 | if (readMethodParseResults == null) { |
49 | 0 | return false; |
50 | } | |
51 | ||
52 | 0 | Class type = readMethodParseResults.getType(); |
53 | 0 | if (writeMethodParseResults != null) { |
54 | 0 | if (!type.equals(writeMethodParseResults.getType())) { |
55 | 0 | return false; |
56 | } | |
57 | } | |
58 | 0 | return true; |
59 | } | |
60 | ||
61 | protected boolean appendInconsistencyDescriptions(StringBuffer buffer) { | |
62 | 0 | if (!super.appendInconsistencyDescriptions(buffer)) { |
63 | 0 | return false; |
64 | } | |
65 | ||
66 | 0 | if (readMethodParseResults == null) { |
67 | 0 | buffer.append("\n - Does not have a get() method"); |
68 | 0 | return true; |
69 | } | |
70 | ||
71 | 0 | Class type = readMethodParseResults.getType(); |
72 | 0 | if (writeMethodParseResults != null) { |
73 | 0 | if (!type.equals(writeMethodParseResults.getType())) { |
74 | 0 | buffer.append("\n - Get() and set(v) types do not match"); |
75 | } | |
76 | } | |
77 | 0 | return true; |
78 | } | |
79 | } |