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

com.fasc.open.api.stratey.JsonStrategy Maven / Gradle / Ivy

There is a newer version: 5.6.4.0320
Show newest version
package com.fasc.open.api.stratey;

import com.fasc.open.api.exception.ApiException;

import java.lang.reflect.ParameterizedType;
import java.util.List;

/**
 * @author Fadada
 * 2021/9/8 16:30:57
 */
public interface JsonStrategy {

    /**
     * 转成json串
     *
     * @param object 序列化对象
     * @return json字符串
     * @throws ApiException 异常
     */
    String toJson(Object object) throws ApiException;

    /**
     * 转成Java对象
     *
     * @param json              json串
     * @param parameterizedType 类型
     * @param                泛型
     * @return 泛型实例
     * @throws ApiException 异常
     */
     T toJavaBean(String json, ParameterizedType parameterizedType) throws ApiException;

    /**
     * 转成Java对象
     *
     * @param json json串
     * @param clzz 类名
     * @param   泛型
     * @return 泛型实例
     * @throws ApiException 异常
     */
     T toJavaBean(String json, Class clzz) throws ApiException;

    /**
     * 转成列表
     *
     * @param json json串
     * @param clzz 类名
     * @param   泛型
     * @return 泛型实例
     * @throws ApiException 异常
     */
     List toList(String json, Class clzz) throws ApiException;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy