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

com.mobius.software.mqtt.parser.header.api.Protocol Maven / Gradle / Ivy

There is a newer version: 1.0.6
Show newest version
package com.mobius.software.mqtt.parser.header.api;

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

public enum Protocol
{
	MQTT(1), MQTT_SN(2), COAP(3), AMQP(4);

	private static final Map intToTypeMap = new HashMap();
	private static final Map strToTypeMap = new HashMap();
	static
	{
		for (Protocol type : Protocol.values())
		{
			intToTypeMap.put(type.value, type);
			strToTypeMap.put(type.toString(), type);
		}
	}

	private int value;

	private Protocol(int value)
	{
		this.value = value;
	}

	public static Protocol fromInt(int i)
	{
		Protocol type = intToTypeMap.get(Integer.valueOf(i));
		return type;
	}

	public static Protocol fromString(String value)
	{
		return strToTypeMap.get(value);
	}

	public int getValue()
	{
		return value;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy