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

io.polyglotted.pgmodel.search.query.ResponseHeader Maven / Gradle / Ivy

Go to download

Standard set of models for geo coding, access control and elastic search abstraction

The newest version!
package io.polyglotted.pgmodel.search.query;

import com.google.common.collect.ImmutableList;
import lombok.RequiredArgsConstructor;
import lombok.ToString;

import java.util.Objects;

import static io.polyglotted.pgmodel.util.ModelUtil.serialize;

@RequiredArgsConstructor
@ToString(includeFieldNames = false, doNotUseGetters = true)
public final class ResponseHeader {
    public final long tookInMillis;
    public final long totalHits;
    public final long returnedHits;
    public final String scrollId;

    @Override
    public boolean equals(Object o) {
        return this == o || (!(o == null || getClass() != o.getClass()) &&
           equalizer().equals(((ResponseHeader) o).equalizer()));
    }

    @Override
    public int hashCode() {
        return Objects.hash(tookInMillis, totalHits, returnedHits, scrollId);
    }

    private String equalizer() {
        return serialize(ImmutableList.of(totalHits, returnedHits, scrollId == null ? "" : scrollId));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy