1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.kuali.student.contract.writer.service; |
17 |
|
|
18 |
|
import org.kuali.student.contract.model.MessageStructure; |
19 |
|
import org.kuali.student.contract.model.ServiceContractModel; |
20 |
|
import org.kuali.student.contract.writer.JavaClassWriter; |
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
@author |
25 |
|
|
|
|
| 0% |
Uncovered Elements: 35 (35) |
Complexity: 12 |
Complexity Density: 0.67 |
|
26 |
|
public class GetterSetterNameCalculator { |
27 |
|
|
28 |
|
private MessageStructure ms; |
29 |
|
private JavaClassWriter writer; |
30 |
|
private ServiceContractModel model; |
31 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
32 |
0
|
public GetterSetterNameCalculator(MessageStructure ms,... |
33 |
|
JavaClassWriter writer, |
34 |
|
ServiceContractModel model) { |
35 |
0
|
this.ms = ms; |
36 |
0
|
this.writer = writer; |
37 |
0
|
this.model = model; |
38 |
|
} |
39 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
40 |
0
|
public String calcGetter() {... |
41 |
0
|
if (calcFieldTypeToUse(ms.getType()).equals("Boolean")) { |
42 |
0
|
if (ms.getShortName().toLowerCase().startsWith("is")) { |
43 |
0
|
return calcInitLower(ms.getShortName()); |
44 |
|
} |
45 |
0
|
return "is" + calcInitUpper(ms.getShortName()); |
46 |
|
} |
47 |
0
|
return "get" + calcInitUpper(ms.getShortName()); |
48 |
|
} |
49 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 3 |
Complexity Density: 0.75 |
|
50 |
0
|
public String calcSetter() {... |
51 |
0
|
if (calcFieldTypeToUse(ms.getType()).equals("Boolean")) { |
52 |
0
|
if (ms.getShortName().toLowerCase().startsWith("is")) { |
53 |
0
|
return "set" + calcInitUpper(ms.getShortName().substring(2)); |
54 |
|
} |
55 |
|
} |
56 |
0
|
return "set" + calcInitUpper(ms.getShortName()); |
57 |
|
} |
58 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
59 |
0
|
public static String calcInitUpper(String name) {... |
60 |
0
|
return name.substring(0, 1).toUpperCase() + name.substring(1); |
61 |
|
} |
62 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
63 |
0
|
public static String calcInitLower(String name) {... |
64 |
0
|
return name.substring(0, 1).toLowerCase() + name.substring(1); |
65 |
|
} |
66 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
67 |
0
|
public String calcFieldTypeToUse(String type) {... |
68 |
0
|
return MessageStructureTypeCalculator.calculate(writer, model, type, type, null); |
69 |
|
} |
70 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
71 |
0
|
public static String stripList(String str) {... |
72 |
0
|
if (str.endsWith("List")) { |
73 |
0
|
return str.substring(0, str.length() - "List".length()); |
74 |
|
} |
75 |
0
|
return str; |
76 |
|
} |
77 |
|
} |