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  
17  package org.forgerock.api.transform;
18  
19  import io.swagger.models.properties.Property;
20  import io.swagger.models.properties.RefProperty;
21  import org.forgerock.util.i18n.LocalizableString;
22  
23  /** Localizable {@link RefProperty}. */
24  public class LocalizableRefProperty extends RefProperty implements LocalizableProperty<Property> {
25      private LocalizableString title;
26      private LocalizableString description;
27  
28      /**
29       * Creates a new {@code LocalizableRefProperty}.
30       */
31      public LocalizableRefProperty() {
32          super();
33      }
34  
35      /**
36       * Creates a new {@code LocalizableRefProperty} with the given JSON Reference.
37       *
38       * @param ref JSON Reference
39       */
40      public LocalizableRefProperty(String ref) {
41          super(ref);
42      }
43  
44      @Override
45      public LocalizableRefProperty title(String title) {
46          setTitle(title);
47          return this;
48      }
49  
50      @Override
51      public LocalizableRefProperty title(LocalizableString title) {
52          this.title = title;
53          return this;
54      }
55  
56      @Override
57      public LocalizableRefProperty description(LocalizableString description) {
58          this.description = description;
59          return this;
60      }
61  
62      @Override
63      public void setTitle(String title) {
64          super.setTitle(title);
65          this.title = new LocalizableString(title);
66      }
67  
68      @Override
69      public LocalizableRefProperty description(String description) {
70          setDescription(description);
71          return this;
72      }
73  
74      @Override
75      public void setDescription(String description) {
76          super.setDescription(description);
77          this.description = new LocalizableString(description);
78      }
79  
80      @Override
81      public LocalizableString getLocalizableTitle() {
82          return title;
83      }
84  
85      @Override
86      public LocalizableString getLocalizableDescription() {
87          return description;
88      }
89  }