View Javadoc
1   /*
2    * The contents of this file are subject to the terms of the Common Development and
3    * Distribution License (the License). You may not use this file except in compliance with the
4    * License.
5    *
6    * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
7    * specific language governing permission and limitations under the License.
8    *
9    * When distributing Covered Software, include this CDDL Header Notice in each file and include
10   * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
11   * Header, with the fields enclosed by brackets [] replaced by your own identifying
12   * information: "Portions copyright [year] [name of copyright owner]".
13   *
14   * Copyright 2016 ForgeRock AS.
15   */
16  package org.forgerock.api.transform;
17  
18  import org.forgerock.util.i18n.LocalizableString;
19  
20  import io.swagger.models.RefModel;
21  
22  /** Localizable {@link RefModel}. */
23  class LocalizableRefModel extends RefModel implements LocalizableTitleAndDescription<LocalizableRefModel> {
24      private LocalizableString title;
25      private LocalizableString description;
26  
27      @Override
28      public LocalizableRefModel title(String title) {
29          setTitle(title);
30          return this;
31      }
32  
33      @Override
34      public LocalizableRefModel title(LocalizableString title) {
35          this.title = title;
36          return this;
37      }
38  
39      @Override
40      public LocalizableRefModel description(LocalizableString description) {
41          this.description = description;
42          return this;
43      }
44  
45      @Override
46      public void setTitle(String title) {
47          super.setTitle(title);
48          this.title = new LocalizableString(title);
49      }
50  
51      @Override
52      public LocalizableRefModel description(String description) {
53          setDescription(description);
54          return this;
55      }
56  
57      @Override
58      public void setDescription(String description) {
59          super.setDescription(description);
60          this.description = new LocalizableString(description);
61      }
62  
63      @Override
64      public LocalizableString getLocalizableTitle() {
65          return title;
66      }
67  
68      @Override
69      public LocalizableString getLocalizableDescription() {
70          return description;
71      }
72  }