1 package com.acumenvelocity.ath.model.x;
2
3 import java.util.ArrayList;
4 import java.util.List;
5 import java.util.Objects;
6
7 import com.acumenvelocity.ath.common.ConversionUtil;
8 import com.acumenvelocity.ath.common.exception.AthRuntimeException;
9 import com.acumenvelocity.ath.model.InlineCode;
10 import com.fasterxml.jackson.annotation.JsonProperty;
11
12 import io.swagger.annotations.ApiModel;
13 import io.swagger.annotations.ApiModelProperty;
14
15
16
17
18
19
20
21 @ApiModel(description = "Text and inline codes markup.")
22 @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaInflectorServerCodegen", comments = "Generator version: 7.15.0")
23 public class LayeredTextX {
24 @JsonProperty("language")
25 private String language;
26
27 @JsonProperty("text")
28 private String text;
29
30 @JsonProperty("codes")
31 private List<InlineCode> codes = new ArrayList<>();
32
33 @JsonProperty("textWithCodes")
34 private String textWithCodes;
35
36
37
38
39 public LayeredTextX language(String language) {
40 this.language = language;
41 return this;
42 }
43
44 @ApiModelProperty(example = "en-US", required = true, value = "The language of the text.")
45 @JsonProperty("language")
46 public String getLanguage() {
47 return language;
48 }
49
50 public void setLanguage(String language) {
51 this.language = language;
52 }
53
54
55
56
57 public LayeredTextX text(String text) {
58 this.text = text;
59 return this;
60 }
61
62 @ApiModelProperty(required = true, value = "Raw text, contains no placeholders for codes or markup.")
63 @JsonProperty("text")
64 public String getText() {
65 return text;
66 }
67
68 public void setText(String text) {
69 this.text = text;
70 }
71
72
73
74
75 public LayeredTextX codes(List<InlineCode> codes) {
76 this.codes = codes;
77 return this;
78 }
79
80 @ApiModelProperty(required = true, value = "Array of inline codes as a layer over text.")
81 @JsonProperty("codes")
82 public List<InlineCode> getCodes() {
83 return codes;
84 }
85
86 public void setCodes(List<InlineCode> codes) {
87 this.codes = codes;
88 }
89
90
91
92
93 public LayeredTextX textWithCodes(String textWithCodes) {
94 this.textWithCodes = textWithCodes;
95 return this;
96 }
97
98 @ApiModelProperty(value = "Text and markup combined.")
99 @JsonProperty("textWithCodes")
100 public String getTextWithCodes() {
101 try {
102 textWithCodes = ConversionUtil.toTextFragment(this).toText();
103 return textWithCodes;
104
105 } catch (Exception e) {
106 AthRuntimeException.logAndThrow(this.getClass(), e.getMessage());
107 return "";
108 }
109 }
110
111 public void setTextWithCodes(String textWithCodes) {
112
113 this.textWithCodes = textWithCodes;
114 }
115
116 @Override
117 public boolean equals(Object o) {
118 if (this == o) {
119 return true;
120 }
121 if (o == null || getClass() != o.getClass()) {
122 return false;
123 }
124 LayeredTextX layeredText = (LayeredTextX) o;
125 return Objects.equals(language, layeredText.language) &&
126 Objects.equals(text, layeredText.text) &&
127 Objects.equals(codes, layeredText.codes) &&
128 Objects.equals(textWithCodes, layeredText.textWithCodes);
129 }
130
131 @Override
132 public int hashCode() {
133 return Objects.hash(language, text, codes, textWithCodes);
134 }
135
136 @Override
137 public String toString() {
138 StringBuilder sb = new StringBuilder();
139 sb.append("class LayeredText {\n");
140
141 sb.append(" language: ").append(toIndentedString(language)).append("\n");
142 sb.append(" text: ").append(toIndentedString(text)).append("\n");
143 sb.append(" codes: ").append(toIndentedString(codes)).append("\n");
144 sb.append(" textWithCodes: ").append(toIndentedString(textWithCodes)).append("\n");
145 sb.append("}");
146 return sb.toString();
147 }
148
149
150
151
152
153 private String toIndentedString(Object o) {
154 if (o == null) {
155 return "null";
156 }
157 return o.toString().replace("\n", "\n ");
158 }
159 }