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

com.futuresight.util.mystique.lever.JsonConvertor Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) Balajee TM 2016.
 * All rights reserved.
 * License -  @see 
 */

/*
 * Created on 25 Aug, 2016 by balajeetm
 */
package com.futuresight.util.mystique.lever;

import java.io.InputStream;
import java.util.List;

/**
 * The Interface JsonConvertor.
 *
 * @author balajeetm
 */
public interface JsonConvertor {

	/**
	 * Deserialize.
	 * 
	 * @param  the generic type
	 * @param objectString the object string
	 * @param objectType the object type
	 * @return the t
	 * @throws ConvertorException the convertor exception
	 */
	 T deserialize(String objectString, Class objectType) throws ConvertorException;

	/**
	 * Deserialize.
	 *
	 * @param  the generic type
	 * @param object the object
	 * @param objectType the object type
	 * @return the t
	 * @throws ConvertorException the convertor exception
	 */
	 T deserialize(Object object, Class objectType) throws ConvertorException;

	/**
	 * Deserialize.
	 * 
	 * @param  the generic type
	 * @param inputStream the input stream
	 * @param objectType the object type
	 * @return the t
	 * @throws ConvertorException the convertor exception
	 */
	 T deserialize(InputStream inputStream, Class objectType) throws ConvertorException;

	/**
	 * Serialize.
	 * 
	 * @param value the value
	 * @return the string
	 * @throws ConvertorException the convertor exception
	 */
	String serialize(Object value) throws ConvertorException;

	/**
	 * Deserialize group.
	 *
	 * @param  the generic type
	 * @param  the generic type
	 * @param objectString the object string
	 * @param groupClass the group class
	 * @param elementClass the element class
	 * @return the t
	 * @throws ConvertorException the convertor exception
	 */
	 T deserializeGroup(String objectString, Class groupClass, Class elementClass)
			throws ConvertorException;

	/**
	 * Deserialize group.
	 * 
	 * @param  the generic type
	 * @param inputStream the input stream
	 * @param groupClass the group class
	 * @param elementClass the element class
	 * @return the t
	 * @throws ConvertorException the convertor exception
	 */
	 T deserializeGroup(InputStream inputStream, Class groupClass, Class elementClass)
			throws ConvertorException;

	/**
	 * Deserialize list.
	 *
	 * @param  the generic type
	 * @param inputStream the input stream
	 * @param elementClass the element class
	 * @return the list
	 * @throws ConvertorException the convertor exception
	 */
	 List deserializeList(InputStream inputStream, Class elementClass) throws ConvertorException;

	/**
	 * Deserialize list.
	 *
	 * @param  the generic type
	 * @param jsonString the json string
	 * @param elementClass the element class
	 * @return the list
	 * @throws ConvertorException the convertor exception
	 */
	 List deserializeList(String jsonString, Class elementClass) throws ConvertorException;

	/**
	 * Deserialize list.
	 *
	 * @param  the generic type
	 * @param object the object
	 * @param elementClass the element class
	 * @return the list
	 * @throws ConvertorException the convertor exception
	 */
	 List deserializeList(Object object, Class elementClass) throws ConvertorException;
}