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

com.firefly.example.reactive.coffee.store.vo.ResponseStatus Maven / Gradle / Ivy

There is a newer version: 5.0.2
Show newest version
package com.firefly.example.reactive.coffee.store.vo;

import java.util.HashMap;
import java.util.Map;
import java.util.Optional;

/**
 * @author Pengtao Qiu
 */
public enum ResponseStatus {

    OK(1, "ok"),
    ARGUMENT_ERROR(2, "argument error"),
    SERVER_ERROR(3, "server error");

    private final int value;
    private final String description;

    static class Holder {
        static final Map map = new HashMap<>();
    }

    ResponseStatus(int value, String description) {
        this.value = value;
        this.description = description;
        Holder.map.put(value, this);
    }

    public int getValue() {
        return value;
    }

    public String getDescription() {
        return description;
    }

    public static Optional from(int value) {
        return Optional.ofNullable(Holder.map.get(value));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy