@Override
    public String toString() {
        return "BrokerRegistration(id=" + id +
                ", epoch=" + epoch +
                ", incarnationId=" + incarnationId +
                ", listeners=[" +
                listeners.keySet().stream().sorted().
                        map(n -> listeners.get(n).toString()).
                        collect(Collectors.joining(", ")) +
                "], supportedFeatures={" +
                supportedFeatures.keySet().stream().sorted().
                        map(k -> k + ": " + supportedFeatures.get(k)).
                        collect(Collectors.joining(", ")) +
                "}" +
                ", rack=" + rack +
                ", fenced=" + fenced +
                ", inControlledShutdown=" + inControlledShutdown +
                ", isMigratingZkBroker=" + isMigratingZkBroker +
                ", directories=" + directories +
                ")";
    }
An immutable class which represents broker registrations.
metadata/src/main/java/org/apache/kafka/metadata/BrokerRegistration.java