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

com.firefly.example.reactive.coffee.store.vo.OrderStatus 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 OrderStatus {

    UNPAID(1, "unpaid"),
    PURCHASED(2, "purchased"),
    SHIPPED(3, "shipped"),
    FINISHED(4, "finished"),
    CANCELED(5, "canceled"),
    REFUND(6, "refund");

    private final int value;
    private final String description;

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

    OrderStatus(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