package com.gfi.serializer;

import java.io.IOException;
import java.math.BigDecimal;

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 com.gfi.utils.Utilities;

/**
 * JsonBigDecimalDeserializer.
 * 
 *  
 */
public class JsonImporteDeserializer extends JsonDeserializer<BigDecimal> {

	/**
	 * DesSerializador para importes.
	 * 
	 * @param jsonParser
	 *            JsonParser
	 * @param ctx
	 *            DeserializationContext
	 * @return BigDecimal
	 * @throws IOException
	 *             e
	 * @throws JsonProcessingException
	 *             e
	 * 
	 */
	public BigDecimal deserialize(JsonParser jsonParser, DeserializationContext ctx)
			throws IOException, JsonProcessingException {
		return Utilities.formatStringToImporte(jsonParser.getText());
	}
}