1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.forgerock.api.transform;
18
19 import org.forgerock.util.i18n.LocalizableString;
20
21 import io.swagger.models.Info;
22
23
24
25
26 class LocalizableInfo extends Info implements LocalizableTitleAndDescription<Info> {
27
28 private LocalizableString title;
29 private LocalizableString description;
30
31 @Override
32 public LocalizableInfo title(LocalizableString title) {
33 this.title = title;
34 return this;
35 }
36
37 @Override
38 public LocalizableInfo description(LocalizableString description) {
39 this.description = description;
40 return this;
41 }
42
43 @Override
44 public LocalizableInfo title(String title) {
45 setTitle(title);
46 return this;
47 }
48
49 @Override
50 public void setTitle(String title) {
51 super.setTitle(title);
52 this.title = new LocalizableString(title);
53 }
54
55 @Override
56 public LocalizableInfo description(String description) {
57 setDescription(description);
58 return this;
59 }
60
61 @Override
62 public void setDescription(String description) {
63 super.setDescription(description);
64 this.description = new LocalizableString(description);
65 }
66
67 @Override
68 public LocalizableString getLocalizableTitle() {
69 return title;
70 }
71
72 @Override
73 public LocalizableString getLocalizableDescription() {
74 return description;
75 }
76
77 @Override
78 public LocalizableInfo mergeWith(Info info) {
79 super.mergeWith(info);
80 if (info instanceof LocalizableInfo) {
81 LocalizableInfo localizableInfo = (LocalizableInfo) info;
82 if (localizableInfo.description != null) {
83 this.description = localizableInfo.description;
84 }
85 if (localizableInfo.title != null) {
86 this.title = localizableInfo.title;
87 }
88 } else {
89 if (info.getDescription() != null) {
90 description(info.getDescription());
91 }
92 if (info.getTitle() != null) {
93 title(info.getTitle());
94 }
95 }
96 return this;
97 }
98 }