Skip to content

Commit

Permalink
[COMMON] rewrite ConsumerGroup by java 17 record (#1738)
Browse files Browse the repository at this point in the history
  • Loading branch information
chia7712 authored May 13, 2023
1 parent 62ddcc0 commit 5a42227
Showing 1 changed file with 7 additions and 51 deletions.
58 changes: 7 additions & 51 deletions common/src/main/java/org/astraea/common/admin/ConsumerGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}

0 comments on commit 5a42227

Please sign in to comment.