1 package org.djutils.data;
2
3 import java.io.Serializable;
4
5 import org.djunits.Throw;
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 public class SimpleDataColumn<T> implements DataColumn<T>, Serializable
21 {
22
23 private static final long serialVersionUID = 20200229L;
24
25
26 private final String id;
27
28
29 private final String description;
30
31
32 private final Class<T> valueType;
33
34
35
36
37
38
39
40 public SimpleDataColumn(final String id, final String description, final Class<T> valueType)
41 {
42 Throw.whenNull(id, "id cannot be null");
43 Throw.when(id.length() == 0, IllegalArgumentException.class, "id cannot be empty");
44 Throw.whenNull(description, "description cannot be null");
45 Throw.whenNull(valueType, "valueType cannot be null");
46 this.id = id;
47 this.description = description;
48 this.valueType = valueType;
49 }
50
51
52 @Override
53 public final String getId()
54 {
55 return this.id;
56 }
57
58
59 @Override
60 public final String getDescription()
61 {
62 return this.description;
63 }
64
65
66 @Override
67 public Class<T> getValueType()
68 {
69 return this.valueType;
70 }
71
72
73 @Override
74 public String toString()
75 {
76 return "SimpleDataColumn [id=" + this.id + ", description=" + this.description + ", valueType=" + this.valueType + "]";
77 }
78
79 }
80