pl.allegro.tech.hermes.common.kafka.KafkaTopic Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hermes-common Show documentation
Show all versions of hermes-common Show documentation
Fast and reliable message broker built on top of Kafka.
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();
}
}