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

com.thematchbox.river.batch.BatchIndexKey Maven / Gradle / Ivy

Go to download

This project contains an abstract implementation of an ElasticSearch River and is used as a basis for custom river implementations.

There is a newer version: 1.1.3
Show newest version
package com.thematchbox.river.batch;

import com.thematchbox.river.actions.IndexKey;
import com.thematchbox.river.data.PersistentObject;

public abstract class BatchIndexKey, T extends PersistentObject> extends IndexKey {

    public final ItemContainer payLoad;
    public final String id;

    protected BatchIndexKey(String indexName, String indexType, ItemContainer payLoad, String id) {
        super(indexName, indexType);
        this.payLoad = payLoad;
        this.id = id;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;

        BatchIndexKey that = (BatchIndexKey) o;

        return id.equals(that.id);

    }

    @Override
    public int hashCode() {
        int result = super.hashCode();
        result = 31 * result + id.hashCode();
        return result;
    }

    @SuppressWarnings("UnusedDeclaration")
    public ItemContainer getPayLoad() {
        return payLoad;
    }
}