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

pl.allegro.tech.hermes.consumers.consumer.rate.maxrate.ConsumerRateInfo Maven / Gradle / Ivy

There is a newer version: 2.8.0
Show newest version
package pl.allegro.tech.hermes.consumers.consumer.rate.maxrate;

import java.util.Objects;
import java.util.Optional;

final class ConsumerRateInfo {

    private final String consumerId;
    private final Optional maxRate;
    private final RateHistory history;

    ConsumerRateInfo(String consumerId, RateInfo rateInfo) {
        this.consumerId = consumerId;
        this.maxRate = rateInfo.getMaxRate();
        this.history = rateInfo.getRateHistory();
    }

    Optional getMaxRate() {
        return maxRate;
    }

    RateHistory getHistory() {
        return history;
    }

    String getConsumerId() {
        return consumerId;
    }

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

    @Override
    public int hashCode() {
        return Objects.hash(consumerId);
    }

    @Override
    public String toString() {
        return "ConsumerRateInfo{"
                + "consumerId='" + consumerId + '\''
                + ", maxRate=" + maxRate
                + ", history=" + history
                + '}';
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy