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

com.twilio.sdk.converter.CurrencyDeserializer Maven / Gradle / Ivy

The newest version!
package com.twilio.sdk.converter;

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

import java.io.IOException;
import java.util.Currency;

public class CurrencyDeserializer extends JsonDeserializer {

    @Override
    public Currency deserialize(JsonParser jsonParser,
                                DeserializationContext deserializationContext) throws IOException {

        String currencyCode = jsonParser.readValueAs(String.class);
        return Currency.getInstance(currencyCode.toUpperCase());

    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy