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

io.polyglotted.elastic.common.DocStatus Maven / Gradle / Ivy

There is a newer version: 6.8.5
Show newest version
package io.polyglotted.elastic.common;

import io.polyglotted.common.util.MapBuilder.ImmutableMapBuilder;

import java.util.Map;

import static io.polyglotted.common.util.MapBuilder.immutableMapBuilder;

public enum DocStatus {
    LIVE, UPDATED, DELETED, PENDING, PENDING_DELETE, REJECTED, DISCARDED;

    private static final Map STATUS_MAP = buildStatusMap();

    public static DocStatus fromStatus(String status) { return STATUS_MAP.get(status); }

    private static Map buildStatusMap() {
        ImmutableMapBuilder builder = immutableMapBuilder();
        for (DocStatus status : values()) {
            builder.put(status.name(), status);
            builder.put(status.name().toLowerCase(), status);
        }
        return builder.build();
    }

    @Override public String toString() { return name().toLowerCase(); }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy