1 package io.swagger.v3.oas.models.info;
2
3 import io.swagger.v3.oas.models.annotations.OpenAPI31;
4
5 import java.util.Objects;
6
7 /**
8  * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.0.1/versions/3.0.1.md#infoObject"
9  * @see "https://github.com/OAI/OpenAPI-Specification/blob/3.1.0/versions/3.1.0.md#infoObject"
10  */

11
12 public class Info {
13     private String title = null;
14     private String description = null;
15     private String termsOfService = null;
16     private Contact contact = null;
17     private License license = null;
18     private String version = null;
19     private java.util.Map<String, Object> extensions = null;
20
21     /**
22      * @since 2.2.0 (OpenAPI 3.1.0)
23      */

24     @OpenAPI31
25     private String summary = null;
26
27     /**
28      * returns the title property from a Info instance.
29      *
30      * @return String title
31      **/

32
33     public String getTitle() {
34         return title;
35     }
36
37     public void setTitle(String title) {
38         this.title = title;
39     }
40
41     public Info title(String title) {
42         this.title = title;
43         return this;
44     }
45
46     /**
47      * returns the description property from a Info instance.
48      *
49      * @return String description
50      **/

51
52     public String getDescription() {
53         return description;
54     }
55
56     public void setDescription(String description) {
57         this.description = description;
58     }
59
60     public Info description(String description) {
61         this.description = description;
62         return this;
63     }
64
65     /**
66      * returns the termsOfService property from a Info instance.
67      *
68      * @return String termsOfService
69      **/

70
71     public String getTermsOfService() {
72         return termsOfService;
73     }
74
75     public void setTermsOfService(String termsOfService) {
76         this.termsOfService = termsOfService;
77     }
78
79     public Info termsOfService(String termsOfService) {
80         this.termsOfService = termsOfService;
81         return this;
82     }
83
84     /**
85      * returns the contact property from a Info instance.
86      *
87      * @return Contact contact
88      **/

89
90     public Contact getContact() {
91         return contact;
92     }
93
94     public void setContact(Contact contact) {
95         this.contact = contact;
96     }
97
98     public Info contact(Contact contact) {
99         this.contact = contact;
100         return this;
101     }
102
103     /**
104      * returns the license property from a Info instance.
105      *
106      * @return License license
107      **/

108
109     public License getLicense() {
110         return license;
111     }
112
113     public void setLicense(License license) {
114         this.license = license;
115     }
116
117     public Info license(License license) {
118         this.license = license;
119         return this;
120     }
121
122     /**
123      * returns the version property from a Info instance.
124      *
125      * @return String version
126      **/

127
128     public String getVersion() {
129         return version;
130     }
131
132     public void setVersion(String version) {
133         this.version = version;
134     }
135
136     public Info version(String version) {
137         this.version = version;
138         return this;
139     }
140
141     /**
142      * returns the summary property from a Info instance.
143      *
144      * @since 2.2.0 (OpenAPI 3.1.0)
145      * @return String
146      **/

147     @OpenAPI31
148     public String getSummary() {
149         return summary;
150     }
151
152     /**
153      * @since 2.2.0 (OpenAPI 3.1.0)
154      */

155     @OpenAPI31
156     public void setSummary(String summary) {
157         this.summary = summary;
158     }
159
160     /**
161      * @since 2.2.0 (OpenAPI 3.1.0)
162      */

163     @OpenAPI31
164     public Info summary(String summary) {
165         this.summary = summary;
166         return this;
167     }
168
169     @Override
170     public boolean equals(java.lang.Object o) {
171         if (this == o) {
172             return true;
173         }
174         if (o == null || getClass() != o.getClass()) {
175             return false;
176         }
177         Info info = (Info) o;
178         return Objects.equals(this.title, info.title) &&
179                 Objects.equals(this.description, info.description) &&
180                 Objects.equals(this.termsOfService, info.termsOfService) &&
181                 Objects.equals(this.contact, info.contact) &&
182                 Objects.equals(this.license, info.license) &&
183                 Objects.equals(this.version, info.version) &&
184                 Objects.equals(this.extensions, info.extensions) &&
185                 Objects.equals(this.summary, info.summary);
186     }
187
188     @Override
189     public int hashCode() {
190         return Objects.hash(title, description, termsOfService, contact, license, version, extensions, summary);
191     }
192
193     public java.util.Map<String, Object> getExtensions() {
194         return extensions;
195     }
196
197     public void addExtension(String name, Object value) {
198         if (name == null || name.isEmpty() || !name.startsWith("x-")) {
199             return;
200         }
201         if (this.extensions == null) {
202             this.extensions = new java.util.LinkedHashMap<>();
203         }
204         this.extensions.put(name, value);
205     }
206
207     @OpenAPI31
208     public void addExtension31(String name, Object value) {
209         if (name != null && (name.startsWith("x-oas-") || name.startsWith("x-oai-"))) {
210             return;
211         }
212         addExtension(name, value);
213     }
214
215     public void setExtensions(java.util.Map<String, Object> extensions) {
216         this.extensions = extensions;
217     }
218
219     public Info extensions(java.util.Map<String, Object> extensions) {
220         this.extensions = extensions;
221         return this;
222     }
223
224     @Override
225     public String toString() {
226         StringBuilder sb = new StringBuilder();
227         sb.append("class Info {\n");
228
229         sb.append("    title: ").append(toIndentedString(title)).append("\n");
230         sb.append("    description: ").append(toIndentedString(description)).append("\n");
231         sb.append("    summary: ").append(toIndentedString(summary)).append("\n");
232         sb.append("    termsOfService: ").append(toIndentedString(termsOfService)).append("\n");
233         sb.append("    contact: ").append(toIndentedString(contact)).append("\n");
234         sb.append("    license: ").append(toIndentedString(license)).append("\n");
235         sb.append("    version: ").append(toIndentedString(version)).append("\n");
236         sb.append("}");
237         return sb.toString();
238     }
239
240     /**
241      * Convert the given object to string with each line indented by 4 spaces
242      * (except the first line).
243      */

244     private String toIndentedString(java.lang.Object o) {
245         if (o == null) {
246             return "null";
247         }
248         return o.toString().replace("\n""\n    ");
249     }
250
251 }
252
253