galovics commented on code in PR #4640:
URL: https://github.com/apache/fineract/pull/4640#discussion_r2240823015


##########
fineract-client/src/main/java/org/apache/fineract/client/models/SurveyResponseData.java:
##########
@@ -0,0 +1,62 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.fineract.client.models;
+
+import java.util.Objects;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.experimental.Accessors;
+
+/**
+ * Model representing a survey response option
+ */
+@Getter
+@Setter
+@NoArgsConstructor
+@Accessors(chain = true)
+public class SurveyResponseData {
+
+    private String text;
+    private Integer value;
+    private Integer sequenceNo;
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (!(o instanceof SurveyResponseData)) {
+            return false;
+        }
+        SurveyResponseData that = (SurveyResponseData) o;
+        return Objects.equals(text, that.text) && Objects.equals(value, 
that.value) && Objects.equals(sequenceNo, that.sequenceNo);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(text, value, sequenceNo);
+    }
+
+    @Override
+    public String toString() {
+        return "SurveyResponseData{" + "text='" + text + '\'' + ", value=" + 
value + ", sequenceNo=" + sequenceNo + '}';
+    }

Review Comment:
   Instead of all this and the `@Getter` and `@Setter` annotations, you can use 
`@Data` and all this will be generated.



##########
fineract-provider/src/main/java/org/apache/fineract/spm/data/ResponseData.java:
##########
@@ -18,50 +18,47 @@
  */
 package org.apache.fineract.spm.data;
 
+import java.util.Objects;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
+import lombok.experimental.Accessors;
+
+/**
+ * Model representing a survey response option for internal mapping
+ */
+@Getter
+@Setter
+@NoArgsConstructor
+@AllArgsConstructor
+@Accessors(chain = true)
 public class ResponseData {
 
     private Long id;
     private String text;
     private Integer value;
     private Integer sequenceNo;
 
-    public ResponseData() {
-
-    }
-
-    public ResponseData(final Long id, final String text, final Integer value, 
final Integer sequenceNo) {
-
-        this.id = id;
-        this.text = text;
-        this.value = value;
-        this.sequenceNo = sequenceNo;
-    }
-
-    public Long getId() {
-        return id;
-    }
-
-    public String getText() {
-        return text;
-    }
-
-    public void setText(String text) {
-        this.text = text;
-    }
-
-    public Integer getValue() {
-        return value;
-    }
-
-    public void setValue(Integer value) {
-        this.value = value;
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (!(o instanceof ResponseData that)) {
+            return false;
+        }
+        return Objects.equals(id, that.id) && Objects.equals(text, that.text) 
&& Objects.equals(value, that.value)
+                && Objects.equals(sequenceNo, that.sequenceNo);
     }
 
-    public Integer getSequenceNo() {
-        return sequenceNo;
+    @Override
+    public int hashCode() {
+        return Objects.hash(id, text, value, sequenceNo);
     }
 
-    public void setSequenceNo(Integer sequenceNo) {
-        this.sequenceNo = sequenceNo;
+    @Override
+    public String toString() {
+        return "ResponseData{" + "id=" + id + ", text='" + text + '\'' + ", 
value=" + value + ", sequenceNo=" + sequenceNo + '}';

Review Comment:
   Same as for the other, use `@Data`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to