Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 招摇过市-如何为DTO中的int设置默认值0_Java_Json_Swagger_Dto - Fatal编程技术网

Java 招摇过市-如何为DTO中的int设置默认值0

Java 招摇过市-如何为DTO中的int设置默认值0,java,json,swagger,dto,Java,Json,Swagger,Dto,我的代码: @ApiModelProperty(required = true, value = "") @JsonProperty(value="id") public int getWareHouseID() { return wareHouseID; } public void setWareHouseID(int wareHouseID) { this.wareHouseID = wareHouseID; } @ApiModelProperty(required =

我的代码:

@ApiModelProperty(required = true, value = "")
@JsonProperty(value="id")
public int getWareHouseID() {
    return wareHouseID;
}

public void setWareHouseID(int wareHouseID) {
    this.wareHouseID = wareHouseID;
}

@ApiModelProperty(required = true, value = "")
@JsonProperty(value="pId")
public int getParentID() {
    return parentID;
}

public void setParentID(int parentID) {
    this.parentID = parentID;
}
招摇过市的结果:

{ 名称:string, 仓库ID:int, 公司名称:string, 全名:string, 地址:string, 父ID:int }

我的问题:为什么int的结果是String?如何设置默认值为:0


谢谢大家。

您好,看起来warehouseID和parentID都是正确的类型。您可以分享更多关于您的版本以及如何集成的信息吗?您还可以使用注释中的example属性设置示例值。您好@fehguy,我解决了我的问题。Tks 4回复!