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

com.quotemedia.streamer.client.mapper.Tick Maven / Gradle / Ivy

package com.quotemedia.streamer.client.mapper;

import com.fasterxml.jackson.annotation.JsonValue;
import com.quotemedia.streamer.messages.market.DataMessage;

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

// com.quotemedia.datacache.data.Tick
public enum Tick implements DataMessage {
    UP('U'),
    DOWN('D'),
    NONE('N');

    private final char id;

    Tick(final char id) {
        this.id = id;
    }

    public final char id() {
        return this.id;
    }

    private static final Map IDtoENUM;

    @JsonValue
    public char getValue(){
        return id;
    }

    static {
        IDtoENUM = new HashMap<>();
        for (final Tick val : Tick.values()) {
            IDtoENUM.put(val.id, val);
        }
    }

    public static Tick forid(final char id) {
        final Tick val = IDtoENUM.get(id);
        if (val == null) {
            throw new IllegalArgumentException("Invalid Tick id " + id);
        }
        return val;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy