Class TopicIdAndName

java.lang.Object
org.apache.kafka.common.TopicIdAndName

public class TopicIdAndName extends Object
Represents a Kafka topic with both its globally unique ID and name. Uniqueness and Equality: For this class, both the ID and name together form the complete unique identifier for a topic. Two TopicIdAndName objects are considered to represent different topics if they have different IDs, even if they have the same name. This means that topics with the same name but different IDs are treated as distinct entities, which can occur in scenarios such as: - Topic recreation after deletion (new ID assigned) - Cross-cluster topic references - Historical topic snapshots This class is immutable and thread-safe.
  • Constructor Details

    • TopicIdAndName

      public TopicIdAndName(Uuid id, String name)
      Creates a new TopicIdAndName with the specified ID and name. Both id and name must be provided and be non-null.
      Parameters:
      id - the globally unique ID for the topic (must not be null)
      name - the name for the topic (must not be null)
  • Method Details

    • id

      public Uuid id()
      Returns the topic ID for this topic.
      Returns:
      the topic ID (never null)
    • name

      public String name()
      Returns the topic name for this topic.
      Returns:
      the topic name (never null)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object