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

x7.core.util.ViewEntityUtil Maven / Gradle / Ivy

There is a newer version: 2.2.7.RELEASE
Show newest version
package x7.core.util;

import com.alibaba.fastjson.JSON;
import x7.core.web.ViewEntity;

import java.util.List;
import java.util.Map;

/**
 * Created by Sim on 2018/1/31.
 */
public class ViewEntityUtil {

    public static  T parseObject(ViewEntity bean, Class clz) {
        T t = JSON.toJavaObject((JSON)bean.getBody(),clz);
        return t;
    }

    public static  List parseList(ViewEntity bean, Class clz) {
        JSON jsonObject = (JSON)bean.getBody();
        String text = jsonObject.toJSONString();
        List list = JSON.parseArray(text, clz);
        return list;
    }

    public static Map parseMap(ViewEntity bean) {
        JSON jsonObject = (JSON)bean.getBody();
        return (Map)jsonObject;
    }

    public static boolean parseBoolean(ViewEntity bean) {
        return Boolean.valueOf(bean.getBody().toString());
    }

    public static long parseLong(ViewEntity bean) {
        return Long.valueOf(bean.getBody().toString());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy