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

com.fireflysource.net.http.common.model.HttpScheme Maven / Gradle / Ivy

There is a newer version: 5.0.2
Show newest version
package com.fireflysource.net.http.common.model;


import com.fireflysource.common.string.StringUtils;

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

public enum HttpScheme {
    HTTP("http"), HTTPS("https"), WS("ws"), WSS("wss");

    private final String value;
    private final byte[] bytes;

    HttpScheme(String value) {
        this.value = value;
        bytes = StringUtils.getUtf8Bytes(value);
        Holder.cache.put(value, this);
    }

    public static HttpScheme from(String value) {
        return Holder.cache.get(value);
    }

    public boolean is(String value) {
        return this.value.equalsIgnoreCase(value);
    }

    public String getValue() {
        return value;
    }

    public byte[] getBytes() {
        return bytes;
    }

    @Override
    public String toString() {
        return value;
    }

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy