1 package at.rseiler.spbee.core.pojo;
2
3 import at.rseiler.spbee.core.annotation.MappingConstructor;
4 import at.rseiler.spbee.core.annotation.ReturnNull;
5 import at.rseiler.spbee.core.annotation.RowMapper;
6 import at.rseiler.spbee.core.pojo.annotation.MappingConstructorData;
7 import at.rseiler.spbee.core.pojo.annotation.RowMapperData;
8 import at.rseiler.spbee.core.util.StringUtil;
9
10
11
12
13
14
15 public class ResultSetVariable extends Variable {
16
17 private static final long serialVersionUID = -1847032188564695473L;
18
19 private final boolean returnNull;
20 private final RowMapperData rowMapper;
21 private final MappingConstructorData mappingConstructor;
22
23
24
25
26
27
28
29
30
31
32 public ResultSetVariable(String name, String qualifiedClassName, RowMapper rowMapper, ReturnNull returnNull, MappingConstructor mappingConstructor) {
33 super(name, qualifiedClassName);
34 this.rowMapper = rowMapper != null ? new RowMapperData(rowMapper) : null;
35 this.returnNull = returnNull != null;
36 this.mappingConstructor = new MappingConstructorData(mappingConstructor);
37 }
38
39
40
41
42
43
44 public String getRowMapper() {
45 if (rowMapper != null) {
46 return rowMapper.getType();
47 }
48
49 return StringUtil.getQualifiedMapperClassName(getTypeInfo().getGenericTypeOrType(), mappingConstructor.getName());
50 }
51
52
53
54
55
56
57
58 public boolean useNullInsteadOfAnException() {
59 return returnNull;
60 }
61
62 }