{"id":1564,"date":"2025-01-24T11:08:51","date_gmt":"2025-01-24T03:08:51","guid":{"rendered":"https:\/\/blog.ttwow.top\/?p=1564"},"modified":"2026-06-19T21:50:46","modified_gmt":"2026-06-19T13:50:46","slug":"java%e9%80%9a%e7%94%a8%e8%bf%94%e5%9b%9e%e5%ae%9e%e4%bd%93%e7%b1%bb","status":"publish","type":"post","link":"https:\/\/blog.ttwow.top\/?p=1564","title":{"rendered":"java\u901a\u7528\u8fd4\u56de\u5b9e\u4f53\u7c7b"},"content":{"rendered":"<pre><code class=\"language-java\">\npublic class ResponseData&lt;T&gt; {\n    private boolean success;\n    private String message;\n    private T data;\n\n    public ResponseData(boolean success, String message, T data) {\n        this.success = success;\n        this.message = message;\n        this.data = data;\n    }\n\n    public static &lt;T&gt; ResponseData&lt;T&gt; success() {\n        return new ResponseData&lt;&gt;(true, &quot;\u6210\u529f&quot;, null);\n    }\n\n    public static &lt;T&gt; ResponseData&lt;T&gt; success(String message, T data) {\n        return new ResponseData&lt;&gt;(true, message, data);\n    }\n\n    public static &lt;T&gt; ResponseData&lt;T&gt; success(String message) {\n        return new ResponseData&lt;&gt;(true, message, null);\n    }\n\n    public static &lt;T&gt; ResponseData&lt;T&gt; failure() {\n        return new ResponseData&lt;&gt;(false, &quot;\u5931\u8d25&quot;, null);\n    }\n    public static &lt;T&gt; ResponseData&lt;T&gt; failure(String message, T data) {\n        return new ResponseData&lt;&gt;(false, message, data);\n    }\n\n    public static &lt;T&gt; ResponseData&lt;T&gt; failure(String message) {\n        return new ResponseData&lt;&gt;(false, message, null);\n    }\n\n    public boolean isSuccess() {\n        return success;\n    }\n\n    public void setSuccess(boolean success) {\n        this.success = success;\n    }\n\n    public String getMessage() {\n        return message;\n    }\n\n    public void setMessage(String message) {\n        this.message = message;\n    }\n\n    public T getData() {\n        return data;\n    }\n\n    public void setData(T data) {\n        this.data = data;\n    }\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>public class ResponseData&lt;T&gt; { private boolean su [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[135],"tags":[],"class_list":["post-1564","post","type-post","status-publish","format-standard","hentry","category-code-snippets"],"_links":{"self":[{"href":"https:\/\/blog.ttwow.top\/index.php?rest_route=\/wp\/v2\/posts\/1564","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ttwow.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ttwow.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ttwow.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ttwow.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1564"}],"version-history":[{"count":1,"href":"https:\/\/blog.ttwow.top\/index.php?rest_route=\/wp\/v2\/posts\/1564\/revisions"}],"predecessor-version":[{"id":1565,"href":"https:\/\/blog.ttwow.top\/index.php?rest_route=\/wp\/v2\/posts\/1564\/revisions\/1565"}],"wp:attachment":[{"href":"https:\/\/blog.ttwow.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1564"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ttwow.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1564"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ttwow.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1564"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}