1 package at.rseiler.spbee.core.pojo;
2
3 import java.io.Serializable;
4 import java.util.Optional;
5
6
7
8
9
10
11 public class TypeInfo implements Serializable {
12
13 private static final long serialVersionUID = -6281028938216215481L;
14
15 private final String type;
16 private final String genericType;
17
18
19
20
21
22
23 public TypeInfo(String type) {
24 this(type, null);
25 }
26
27
28
29
30
31
32
33 public TypeInfo(String type, String genericType) {
34 this.type = type;
35 this.genericType = genericType;
36 }
37
38
39
40
41
42
43
44
45
46
47
48 public String getType() {
49 return type;
50 }
51
52
53
54
55
56
57
58
59
60
61
62 public Optional<String> getGenericType() {
63 return Optional.ofNullable(genericType);
64 }
65
66
67
68
69
70
71
72
73
74
75
76 public String getGenericTypeOrType() {
77 return Optional.ofNullable(genericType).orElse(type);
78 }
79
80
81
82
83
84
85 public String asString() {
86 return genericType != null ? type + '<' + genericType + '>' : type;
87 }
88
89 @Override
90 public String toString() {
91 return "TypeInfo{" +
92 "type='" + type + '\'' +
93 ", genericType=" + genericType +
94 '}';
95 }
96
97 }