FirstColumnProjector.java
biz/hammurapi/sql/FirstColumnProjector.java
Violations
Inspector |
Message |
Severity |
Location |
Java Inspector 048 |
Copyrights information should be present in each file. |
1 |
|
Java Inspector 089 |
Undocumented constructor |
2 |
39:9
|
Java Inspector 089 |
Undocumented constructor |
2 |
43:9
|
Java Inspector 089 |
Undocumented method |
2 |
47:9
|
Java Inspector 051 |
It is good practice to call in any case super() in a constructor. |
3 |
39:9
|
Java Inspector 051 |
It is good practice to call in any case super() in a constructor. |
3 |
43:9
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23package biz.hammurapi.sql;
24
25import java.sql.ResultSet;
26import java.sql.SQLException;
27
28import biz.hammurapi.convert.ConvertingService;
29
30
31
32
33
34
35public class FirstColumnProjector implements Projector {
36
37 private Class targetClass;
38
39 public FirstColumnProjector() {
40
41 }
42
43 public FirstColumnProjector(Class targetClass) {
44 this.targetClass=targetClass;
45 }
46
47 public Object project(ResultSet rs) throws SQLException {
48 return targetClass==null ? rs.getObject(1) : ConvertingService.convert(rs.getObject(1), targetClass);
49 }
50}
51