From 5a42227481a936a8218b68e644761a05ce44a44d Mon Sep 17 00:00:00 2001
From: Chia-Ping Tsai <chia7712@gmail.com>
Date: Sat, 13 May 2023 20:12:03 +0800
Subject: [PATCH] [COMMON] rewrite ConsumerGroup by java 17 record (#1738)

---
 .../astraea/common/admin/ConsumerGroup.java   | 58 +++----------------
 1 file changed, 7 insertions(+), 51 deletions(-)

diff --git a/common/src/main/java/org/astraea/common/admin/ConsumerGroup.java b/common/src/main/java/org/astraea/common/admin/ConsumerGroup.java
index de50902c08..29691e8337 100644
--- a/common/src/main/java/org/astraea/common/admin/ConsumerGroup.java
+++ b/common/src/main/java/org/astraea/common/admin/ConsumerGroup.java
@@ -17,56 +17,12 @@
 package org.astraea.common.admin;
 
 import java.util.Map;
-import java.util.Objects;
 import java.util.Set;
 
-public class ConsumerGroup {
-  private final String groupId;
-
-  private final String assignor;
-
-  private final String state;
-
-  private final NodeInfo coordinator;
-  private final Map<TopicPartition, Long> consumeProgress;
-  private final Map<Member, Set<TopicPartition>> assignment;
-
-  ConsumerGroup(
-      String groupId,
-      String assignor,
-      String state,
-      NodeInfo coordinator,
-      Map<TopicPartition, Long> consumeProgress,
-      Map<Member, Set<TopicPartition>> assignment) {
-    this.groupId = Objects.requireNonNull(groupId);
-    this.assignor = assignor;
-    this.state = state;
-    this.coordinator = coordinator;
-    this.consumeProgress = Map.copyOf(consumeProgress);
-    this.assignment = Map.copyOf(assignment);
-  }
-
-  public String groupId() {
-    return groupId;
-  }
-
-  public NodeInfo coordinator() {
-    return coordinator;
-  }
-
-  public Map<Member, Set<TopicPartition>> assignment() {
-    return assignment;
-  }
-
-  public Map<TopicPartition, Long> consumeProgress() {
-    return consumeProgress;
-  }
-
-  public String assignor() {
-    return assignor;
-  }
-
-  public String state() {
-    return state;
-  }
-}
+public record ConsumerGroup(
+    String groupId,
+    String assignor,
+    String state,
+    NodeInfo coordinator,
+    Map<TopicPartition, Long> consumeProgress,
+    Map<Member, Set<TopicPartition>> assignment) {}