类 Json

java.lang.Object
cn.hamm.airpower.model.Json

public class Json extends Object

简单JSON对象

作者:
Hamm.cn
  • 方法详细资料

    • success

      public static Json success(String message)

      输出提示信息

      参数:
      message - 提示信息
      返回:
      Json
    • data

      public static Json data(Object data)

      输出数据

      参数:
      data - 数据
      返回:
      Json
    • entity

      public static <E extends RootEntity<E>> Json entity(@NotNull @NotNull Long id)

      输出实体

      类型参数:
      E - 实体类型
      参数:
      id - 实体ID
      返回:
      Json
    • entity

      public static Json entity(@NotNull @NotNull Long id, @NotNull @NotNull String message)

      输出实体

      参数:
      id - 实体ID
      message - 提示信息
      返回:
      Json
    • data

      public static Json data(Object data, String message)

      输出数据

      参数:
      data - 数据
      message - 提示信息
      返回:
      Json
    • error

      public static Json error(IException error)

      输出错误

      参数:
      error - 错误枚举
      返回:
      Json
    • error

      public static Json error(@NotNull @NotNull IException error, String message)

      输出错误

      参数:
      error - 错误枚举
      message - 错误信息
      返回:
      Json
    • error

      public static Json error(String message)

      输出错误

      参数:
      message - 错误信息
      返回:
      Json
    • show

      public static Json show(int code, String message, Object data)

      输出Json

      参数:
      code - 错误代码
      message - 提示信息
      data - 输出数据
      返回:
      Json
    • parse

      public static <E> E parse(String json, Class<E> clazz)

      Json反序列化到指定类

      类型参数:
      E - 目标类
      参数:
      json - 字符串
      clazz - 目标类
      返回:
      目标类的实例
    • parse2Map

      public static Map<String,Object> parse2Map(String json)

      Json反序列化位Map

      参数:
      json - 字符串
      返回:
      Map
    • parse2MapList

      public static List<Map<String,Object>> parse2MapList(String json)

      Json反序列化为ListMap

      参数:
      json - 字符串
      返回:
      List
    • toString

      public static String toString(Object object)

      Json序列化到字符串

      参数:
      object - 对象
      返回:
      字符串