m1a2st commented on code in PR #18783:
URL: https://github.com/apache/kafka/pull/18783#discussion_r1940723859


##########
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:
   > not really, the pakcage-info.java doesn't simply indicate "public" APIs. 
for example, this 
[package-info.java](https://github.com/apache/kafka/blob/ad031b99d312cdfe452965c841e22c1ab391956e/clients/src/main/java/org/apache/kafka/common/cache/package-info.java#L19)
 is used to announce this package is NOT public APIs.
   
   Although it's not a public API, I prefer to maintain the existing format due 
to its long-standing presence.
   
   Thanks for @chia7712 point out, it seems that we still have to verify it 
through the documents. (Kafka 
KIP)[https://cwiki.apache.org/confluence/display/kafka/kafka+improvement+proposals]
   
   ```
   All of the following are public interfaces that people build around:
       Binary log format
       The network protocol and api behavior
       Any class for which the build generates Javadoc.  This includes (but is 
not limited to; look for javadoc {} sections in build.gradle for the complete 
list):
           org/apache/kafka/common/serialization
           org/apache/kafka/common
           org/apache/kafka/common/errors
           org/apache/kafka/clients/producer
           org/apache/kafka/clients/consumer (eventually, once stable)
       Configuration, especially client configuration
       Monitoring
       Command line tools and arguments
   ```    



-- 
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]

Reply via email to