All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pl.allegro.tech.hermes.common.kafka.KafkaTopic Maven / Gradle / Ivy

There is a newer version: 2.7.0
Show newest version
package pl.allegro.tech.hermes.common.kafka;

import com.google.common.base.MoreObjects;
import pl.allegro.tech.hermes.api.ContentType;

import java.util.Objects;

import static com.google.common.base.Preconditions.checkNotNull;

public class KafkaTopic {

    private final KafkaTopicName name;
    private final ContentType contentType;

    public KafkaTopic(KafkaTopicName name, ContentType contentType) {
        this.name = checkNotNull(name);
        this.contentType = checkNotNull(contentType);
    }

    public KafkaTopicName name() {
        return name;
    }

    public ContentType contentType() {
        return contentType;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        KafkaTopic that = (KafkaTopic) o;
        return Objects.equals(name, that.name)
                && Objects.equals(contentType, that.contentType);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, contentType);
    }

    @Override
    public String toString() {
        return MoreObjects.toStringHelper(this)
                .add("name", name)
                .add("contentType", contentType)
                .toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy