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 public class SimpleDataColumn<T> implements DataColumn<T>, Serializable
20 {
21
22 private static final long serialVersionUID = 20200229L;
23
24
25 private final String id;
26
27
28 private final String description;
29
30
31 private final Class<T> valueType;
32
33
34
35
36
37
38
39 public SimpleDataColumn(final String id, final String description, final Class<T> valueType)
40 {
41 Throw.whenNull(id, "id cannot be null");
42 Throw.when(id.length() == 0, IllegalArgumentException.class, "id cannot be empty");
43 Throw.whenNull(description, "description cannot be null");
44 Throw.whenNull(valueType, "valueType cannot be null");
45 this.id = id;
46 this.description = description;
47 this.valueType = valueType;
48 }
49
50
51 @Override
52 public final String getId()
53 {
54 return this.id;
55 }
56
57
58 @Override
59 public final String getDescription()
60 {
61 return this.description;
62 }
63
64
65 @Override
66 public Class<T> getValueType()
67 {
68 return this.valueType;
69 }
70
71
72 @Override
73 public String toString()
74 {
75 return "SimpleDataColumn [id=" + this.id + ", description=" + this.description + ", valueType=" + this.valueType + "]";
76 }
77
78 }