chia7712 commented on code in PR #18783:
URL: https://github.com/apache/kafka/pull/18783#discussion_r1940701966
##########
server-common/src/main/java/org/apache/kafka/server/common/TopicIdPartition.java:
##########
@@ -18,45 +18,15 @@
import org.apache.kafka.common.Uuid;
-import java.util.Objects;
-
/**
* Represents a partition using its unique topic Id and partition number.
+ * @param topicId Universally unique Id representing this topic partition.
+ * @param partitionId The partition Id.
*/
-public final class TopicIdPartition {
- private final Uuid topicId;
- private final int partitionId;
-
- public TopicIdPartition(Uuid topicId, int partitionId) {
- this.topicId = topicId;
- this.partitionId = partitionId;
- }
-
- /**
- * @return Universally unique Id representing this topic partition.
- */
- public Uuid topicId() {
- return topicId;
- }
-
- /**
- * @return The partition Id.
- */
- public int partitionId() {
- return partitionId;
- }
-
- @Override
- public boolean equals(Object o) {
- if (!(o instanceof TopicIdPartition other)) return false;
- return other.topicId.equals(topicId) && other.partitionId ==
partitionId;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(topicId, partitionId);
- }
-
+public record TopicIdPartition(
+ Uuid topicId,
+ int partitionId
+) {
@Override
public String toString() {
return topicId + ":" + partitionId;
Review Comment:
> In org.apache.kafka.server there is package-info.java
btw, in the server-common module the package `org.apache.kafka.server` has
no `package-info.java`
--
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]