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.ComposedModel;
21  
22  /** Localizable {@link ComposedModel}. */
23  class LocalizableComposedModel extends ComposedModel
24                                 implements LocalizableTitleAndDescription<LocalizableComposedModel> {
25      private LocalizableString title;
26      private LocalizableString description;
27  
28      @Override
29      public LocalizableComposedModel title(String title) {
30          setTitle(title);
31          return this;
32      }
33  
34      @Override
35      public LocalizableComposedModel title(LocalizableString title) {
36          this.title = title;
37          return this;
38      }
39  
40      @Override
41      public LocalizableComposedModel description(LocalizableString description) {
42          this.description = description;
43          return this;
44      }
45  
46      @Override
47      public void setTitle(String title) {
48          super.setTitle(title);
49          this.title = new LocalizableString(title);
50      }
51  
52      @Override
53      public LocalizableComposedModel description(String description) {
54          setDescription(description);
55          return this;
56      }
57  
58      @Override
59      public void setDescription(String description) {
60          super.setDescription(description);
61          this.description = new LocalizableString(description);
62      }
63  
64      @Override
65      public LocalizableString getLocalizableTitle() {
66          return title;
67      }
68  
69      @Override
70      public LocalizableString getLocalizableDescription() {
71          return description;
72      }
73  }