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   * Portions Copyright 2026 Wren Security.
16   */
17  package org.forgerock.api.transform;
18  
19  import com.fasterxml.jackson.annotation.JsonIgnore;
20  import com.fasterxml.jackson.annotation.JsonProperty;
21  import io.swagger.v3.oas.models.parameters.RequestBody;
22  import org.forgerock.util.i18n.LocalizableString;
23  
24  /**
25   * Localizable {@link RequestBody}.
26   */
27  class LocalizableRequestBody extends RequestBody implements LocalizableDescription<RequestBody> {
28  
29      private LocalizableString description;
30  
31      @Override
32      public LocalizableRequestBody description(LocalizableString desc) {
33          this.description = desc;
34          return this;
35      }
36  
37      @Override
38      public LocalizableRequestBody description(String description) {
39          setDescription(description);
40          return this;
41      }
42  
43      @Override
44      public void setDescription(String description) {
45          super.setDescription(description);
46          this.description = new LocalizableString(description);
47      }
48  
49      @Override
50      @JsonProperty("description")
51      public LocalizableString getLocalizableDescription() {
52          return description;
53      }
54  
55      @Override
56      @JsonIgnore
57      public String getDescription() {
58          return super.getDescription();
59      }
60  
61  }