@ApiModelProperty用法

<div id="cnblogs_post_body" class="blogpost-body "> <p>@ApiModelProperty()用於方法,字段; 表示對model屬性的說明或者數據操做更改&nbsp;<br>value–字段說明&nbsp;<br>name–重寫屬性名字&nbsp;<br>dataType–重寫屬性類型&nbsp;<br>required–是否必填&nbsp;<br>example–舉例說明&nbsp;<br>hidden–隱藏</p> <div class="cnblogs_code"><div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="複製代碼"><img src="//common.cnblogs.com/images/copycode.gif" alt="複製代碼"></a></span></div> <pre>@ApiModel(value="user對象",description="用戶對象user"<span style="color: #000000;">) </span><span style="color: #0000ff;">public</span> <span style="color: #0000ff;">class</span> User <span style="color: #0000ff;">implements</span><span style="color: #000000;"> Serializable{ </span><span style="color: #0000ff;">private</span> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">final</span> <span style="color: #0000ff;">long</span> serialVersionUID = 1L<span style="color: #000000;">; @ApiModelProperty(value</span>="用戶名",name="username",example="xingguo"<span style="color: #000000;">) </span><span style="color: #0000ff;">private</span><span style="color: #000000;"> String username; @ApiModelProperty(value</span>="狀態",name="state",required=<span style="color: #0000ff;">true</span><span style="color: #000000;">) </span><span style="color: #0000ff;">private</span><span style="color: #000000;"> Integer state; </span><span style="color: #0000ff;">private</span><span style="color: #000000;"> String password; </span><span style="color: #0000ff;">private</span><span style="color: #000000;"> String nickName; </span><span style="color: #0000ff;">private</span><span style="color: #000000;"> Integer isDeleted;javascript

@ApiModelProperty(value</span>="id數組",hidden=<span style="color: #0000ff;">true</span><span style="color: #000000;">)
  </span><span style="color: #0000ff;">private</span><span style="color: #000000;"> String[] ids;
  </span><span style="color: #0000ff;">private</span> List&lt;String&gt;<span style="color: #000000;"> idList;
 </span><span style="color: #008000;">//</span><span style="color: #008000;">省略get/set</span>

}</pre>html

<div class="cnblogs_code_toolbar"><span class="cnblogs_code_copy"><a href="javascript:void(0);" onclick="copyCnblogsCode(this)" title="複製代碼"><img src="//common.cnblogs.com/images/copycode.gif" alt="複製代碼"></a></span></div></div> <p>原文地址:https://www.cnblogs.com/huanghuanghui/p/9086860.html</p> </div>java

相關文章
相關標籤/搜索