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