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.ServiceContractModel; |
19 |
|
import org.kuali.student.contract.model.ServiceMethodError; |
20 |
|
import org.kuali.student.contract.writer.JavaClassWriter; |
21 |
|
import org.kuali.student.contract.writer.JavaEnumConstantCalculator; |
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
@author |
26 |
|
@deprecated |
27 |
|
|
|
|
| 0% |
Uncovered Elements: 40 (40) |
Complexity: 4 |
Complexity Density: 0.11 |
|
28 |
|
public class ServiceExceptionWriter extends JavaClassWriter { |
29 |
|
|
30 |
|
private ServiceContractModel model; |
31 |
|
private String directory; |
32 |
|
private String rootPackage; |
33 |
|
private ServiceMethodError error; |
34 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
35 |
0
|
public ServiceExceptionWriter(ServiceContractModel model,... |
36 |
|
String directory, |
37 |
|
String rootPackage, |
38 |
|
ServiceMethodError error) { |
39 |
0
|
super(directory, calcPackage(rootPackage), calcClassName(error.getType())); |
40 |
0
|
this.model = model; |
41 |
0
|
this.directory = directory; |
42 |
0
|
this.rootPackage = rootPackage; |
43 |
0
|
this.error = error; |
44 |
|
} |
45 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
46 |
0
|
public static String calcPackage(String rootPackage) {... |
47 |
0
|
return PureJavaInfcServiceWriter.calcPackage("exception", rootPackage); |
48 |
|
} |
49 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
50 |
0
|
public static String calcClassName(String type) {... |
51 |
0
|
return new JavaEnumConstantCalculator(type).reverse() + "Exception"; |
52 |
|
} |
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
@param |
57 |
|
|
|
|
| 0% |
Uncovered Elements: 29 (29) |
Complexity: 1 |
Complexity Density: 0.03 |
|
58 |
0
|
public void write() {... |
59 |
0
|
String className = calcClassName(error.getType()); |
60 |
0
|
indentPrintln("public class " + className + " extends Exception"); |
61 |
0
|
openBrace(); |
62 |
0
|
indentPrintln(""); |
63 |
0
|
indentPrintln("private static final long serialVersionUID = 1L;"); |
64 |
0
|
indentPrintln(""); |
65 |
0
|
indentPrintln("public " + className + "()"); |
66 |
0
|
openBrace(); |
67 |
0
|
indentPrintln("super ();"); |
68 |
0
|
closeBrace(); |
69 |
|
|
70 |
0
|
indentPrintln(""); |
71 |
0
|
indentPrintln("public " + className + "(String msg)"); |
72 |
0
|
openBrace(); |
73 |
0
|
indentPrintln("super (msg);"); |
74 |
0
|
closeBrace(); |
75 |
|
|
76 |
0
|
indentPrintln(""); |
77 |
0
|
indentPrintln("public " + className + "(Throwable cause)"); |
78 |
0
|
openBrace(); |
79 |
0
|
indentPrintln("super (cause);"); |
80 |
0
|
closeBrace(); |
81 |
|
|
82 |
0
|
indentPrintln(""); |
83 |
0
|
indentPrintln("public " + className + "(String msg, Throwable cause)"); |
84 |
0
|
openBrace(); |
85 |
0
|
indentPrintln("super (msg, cause);"); |
86 |
0
|
closeBrace(); |
87 |
|
|
88 |
0
|
indentPrintln(""); |
89 |
0
|
closeBrace(); |
90 |
|
|
91 |
0
|
this.writeJavaClassAndImportsOutToFile(); |
92 |
0
|
this.getOut().close(); |
93 |
|
} |
94 |
|
} |