1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package fr.inrae.agroclim.indicators.model;
18
19 import java.io.Serializable;
20 import java.util.ArrayList;
21 import java.util.List;
22
23 import jakarta.xml.bind.annotation.XmlAccessType;
24 import jakarta.xml.bind.annotation.XmlAccessorType;
25 import jakarta.xml.bind.annotation.XmlElement;
26 import lombok.EqualsAndHashCode;
27 import lombok.Getter;
28 import lombok.Setter;
29
30
31
32
33
34
35
36
37
38 @XmlAccessorType(XmlAccessType.FIELD)
39 @EqualsAndHashCode(
40 callSuper = false,
41 of = {"id", "attribute", "descriptions"}
42 )
43 public final class Parameter implements Cloneable, Serializable {
44
45
46
47
48 private static final long serialVersionUID = 9205643160821888601L;
49
50
51
52
53 @XmlElement
54 @Getter
55 @Setter
56 private String attribute;
57
58
59
60
61 @XmlElement(name = "description")
62 @Getter
63 @Setter
64 private List<LocalizedString> descriptions;
65
66
67
68
69 @XmlElement
70 @Getter
71 @Setter
72 private String id;
73
74
75
76
77 public Parameter() {
78
79 }
80
81 @Override
82 public Parameter clone() throws CloneNotSupportedException {
83 final Parameter clone = (Parameter) super.clone();
84 clone.attribute = attribute;
85 if (descriptions != null) {
86 clone.descriptions = new ArrayList<>();
87 for (final LocalizedString description : descriptions) {
88 clone.descriptions.add(description.clone());
89 }
90 }
91 clone.id = id;
92 return clone;
93 }
94
95
96
97
98
99 public String getDescription(final String languageCode) {
100 return LocalizedString.getString(descriptions, languageCode);
101 }
102
103 }