程序包 cool.scx.mvc.vo

类 DataJson

java.lang.Object
cool.scx.mvc.vo.DataJson
所有已实现的接口:
ScxConsumer<io.vertx.ext.web.RoutingContext,Exception>, BaseVo

public final class DataJson extends Object implements BaseVo
Json 格式的返回值 (注意和 Json 区分, 此格式适合传递单个参数)
版本:
1.9.5
作者:
scx567888
  • 方法详细资料

    • ok

      public static DataJson ok()
      操作成功
      返回:
      json
    • fail

      public static DataJson fail()
      操作失败
      返回:
      json
    • fail

      public static DataJson fail(String failMessage)
      返回操作失败的 Json 带有消息
      参数:
      failMessage - 自定义的错误信息
      返回:
      json
    • data

      public DataJson data(Object dataVal)
      设置操作返回的数据,数据使用自定义的 Object 存储
      若重复调用则之前的会被覆盖
      参数:
      dataVal - 值
      返回:
      json
    • accept

      public void accept(io.vertx.ext.web.RoutingContext context)

      sendToClient

      指定者:
      accept 在接口中 ScxConsumer<io.vertx.ext.web.RoutingContext,Exception>
    • toJson

      public String toJson() throws com.fasterxml.jackson.core.JsonProcessingException
      将内部的 JsonBody 转换为 json 字符串
      返回:
      r
      抛出:
      com.fasterxml.jackson.core.JsonProcessingException - 转换失败
    • toJson

      public String toJson(String defaultValue)
      a
      参数:
      defaultValue - a
      返回:
      a