public void write(ImageWriter writer, ImageWriterOptions options) {
        writer.write(0, new TopicRecord().
            setName(name).
            setTopicId(id));
        for (Entry<Integer, PartitionRegistration> entry : partitions.entrySet()) {
            int partitionId = entry.getKey();
            PartitionRegistration partition = entry.getValue();
            writer.write(partition.toRecord(id, partitionId, options));
        }
    }
Represents a topic in the metadata image.

This class is thread-safe.
metadata/src/main/java/org/apache/kafka/image/TopicImage.java