Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[COMMON] rewrite admin.Member by java 17 record #1735

Merged
merged 1 commit into from
May 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 6 additions & 75 deletions common/src/main/java/org/astraea/common/admin/Member.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,80 +16,11 @@
*/
package org.astraea.common.admin;

import java.util.Objects;
import java.util.Optional;

public final class Member {
private final String groupId;
private final String memberId;
private final Optional<String> groupInstanceId;
private final String clientId;
private final String host;

Member(
String groupId,
String memberId,
Optional<String> groupInstanceId,
String clientId,
String host) {
this.groupId = groupId;
this.memberId = memberId;
this.groupInstanceId = groupInstanceId;
this.clientId = clientId;
this.host = host;
}

@Override
public String toString() {
return "Member{"
+ "memberId='"
+ memberId
+ '\''
+ ", groupInstanceId="
+ groupInstanceId
+ ", clientId='"
+ clientId
+ '\''
+ ", host='"
+ host
+ '\''
+ '}';
}

public String groupId() {
return groupId;
}

public String memberId() {
return memberId;
}

public Optional<String> groupInstanceId() {
return groupInstanceId;
}

public String clientId() {
return clientId;
}

public String host() {
return host;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Member member = (Member) o;
return Objects.equals(groupId, member.groupId)
&& Objects.equals(memberId, member.memberId)
&& Objects.equals(groupInstanceId, member.groupInstanceId)
&& Objects.equals(clientId, member.clientId)
&& Objects.equals(host, member.host);
}

@Override
public int hashCode() {
return Objects.hash(groupId, memberId, groupInstanceId, clientId, host);
}
}
public record Member(
String groupId,
String memberId,
Optional<String> groupInstanceId,
String clientId,
String host) {}