浏览代码

add tostring to bankaccount

Grega Bremec 7 月之前
父节点
当前提交
7eda2bcc98
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      payments-producer/src/main/java/com/redhat/training/kafka/model/BankAccount.java

+ 4 - 1
payments-producer/src/main/java/com/redhat/training/kafka/model/BankAccount.java

@@ -35,5 +35,8 @@ public class BankAccount {
     public void setCustomerId(String customerId) {
         this.customerId = customerId;
     }
-    
+    public String toString() {
+        return String.format("{\"accountId\": \"%s\", \"customerId\": \"%s\", \"customerName\": \"%s\", \"balance\": %d}",
+                                this.accountNumber, this.customerId, this.customerName, this.balance);
+    }
 }