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

com.fnklabs.mt5.client.DealActionDeserializer Maven / Gradle / Ivy

The newest version!
package com.fnklabs.mt5.client;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;

import java.io.IOException;

class DealActionDeserializer extends JsonDeserializer {
    @Override
    public DealAction deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
        String intValue = p.getText();

        for (DealAction value : DealAction.values()) {
            if (value.getCode() == Integer.parseInt(intValue)) {
                return value;
            }
        }

        return null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy