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

com.joseflavio.urucum.json.JSONDesserializador Maven / Gradle / Ivy

There is a newer version: 1.0-A16
Show newest version

/*
 *  Copyright (C) 2016 Jos? Fl?vio de Souza Dias J?nior
 *  
 *  This file is part of Urucum - .
 *  
 *  Urucum is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *  
 *  Urucum is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *  GNU Lesser General Public License for more details.
 *  
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with Urucum. If not, see .
 */

/*
 *  Direitos Autorais Reservados (C) 2016 Jos? Fl?vio de Souza Dias J?nior
 * 
 *  Este arquivo ? parte de Urucum - .
 * 
 *  Urucum ? software livre: voc? pode redistribu?-lo e/ou modific?-lo
 *  sob os termos da Licen?a P?blica Menos Geral GNU conforme publicada pela
 *  Free Software Foundation, tanto a vers?o 3 da Licen?a, como
 *  (a seu crit?rio) qualquer vers?o posterior.
 * 
 *  Urucum ? distribu?do na expectativa de que seja ?til,
 *  por?m, SEM NENHUMA GARANTIA; nem mesmo a garantia impl?cita de
 *  COMERCIABILIDADE ou ADEQUA??O A UMA FINALIDADE ESPEC?FICA. Consulte a
 *  Licen?a P?blica Menos Geral do GNU para mais detalhes.
 * 
 *  Voc? deve ter recebido uma c?pia da Licen?a P?blica Menos Geral do GNU
 *  junto com Urucum. Se n?o, veja .
 */

package com.joseflavio.urucum.json;

import java.io.IOException;

import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import com.fasterxml.jackson.databind.jsontype.TypeDeserializer;

/**
 * {@link JsonDeserializer} de {@link JSON}.
 * @author Jos? Fl?vio de Souza Dias J?nior
 */
public class JSONDesserializador extends StdDeserializer {

	private static final long serialVersionUID = 1L;
	
	public JSONDesserializador() {
		super( JSON.class );
	}
	
	public JSONDesserializador( Class vc ) {
		super( vc );
	}

	public JSONDesserializador( JavaType valueType ) {
		super( valueType );
	}

	public JSONDesserializador( StdDeserializer src ) {
		super( src );
	}

	@Override
	public JSON deserialize( JsonParser p, DeserializationContext ctxt ) throws IOException, JsonProcessingException {
		return new JSON( p.readValueAsTree().toString() );
	}

	@Override
	public Object deserializeWithType( JsonParser p, DeserializationContext ctxt, TypeDeserializer typeDeserializer ) throws IOException {
		return deserialize( p, ctxt );
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy