{"id":1263,"date":"2022-10-28T23:01:37","date_gmt":"2022-10-28T15:01:37","guid":{"rendered":"https:\/\/qaqaq.top\/?p=1263"},"modified":"2022-11-27T12:39:47","modified_gmt":"2022-11-27T04:39:47","slug":"%e6%b3%9b%e5%9e%8b%e4%b8%8efile-%e4%b8%be%e4%be%8b%e6%b3%9b%e5%9e%8b%e7%b1%bb%e5%92%8c%e6%b3%9b%e5%9e%8b%e6%96%b9%e6%b3%95%e7%9a%84%e4%bd%bf%e7%94%a8%e6%83%85%e5%a2%83","status":"publish","type":"post","link":"https:\/\/qaqaq.top\/?p=1263","title":{"rendered":"\u6cdb\u578b\u4e0eFile-\u4e3e\u4f8b\u6cdb\u578b\u7c7b\u548c\u6cdb\u578b\u65b9\u6cd5\u7684\u4f7f\u7528\u60c5\u5883"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>package top.qaqaq.java.P571;\r\n\r\nimport java.util.List;\r\n\r\n\/**\r\n * @author RichieZhang\r\n * @create 2022-10-28 \u4e0b\u5348 9:10\r\n *\r\n * DAO:data(base) access object\r\n *\/\r\npublic class DAO &lt;T>{\/\/\u8868\u7684\u5171\u6027\u64cd\u4f5c\u7684DAO\r\n\r\n    \/\/\u6dfb\u52a0\u4e00\u6761\u8bb0\u5f55\r\n    public void add(T t){\r\n\r\n    }\r\n\r\n    \/\/\u5220\u9664\u4e00\u6761\u8bb0\u5f55\r\n    public boolean remove(int index){\r\n\r\n        return false;\r\n    }\r\n\r\n    \/\/\u4fee\u6539\u4e00\u6761\u8bb0\u5f55\r\n    public void update(int index,T t){\r\n\r\n    }\r\n\r\n    \/\/\u67e5\u8be2\u4e00\u6761\u8bb0\u5f55\r\n    public T getIndex(int index){\r\n\r\n        return null;\r\n    }\r\n    \/\/\u67e5\u8be2\u591a\u6761\u8bb0\u5f55\r\n    public List&lt;T> getForList(int index){\r\n\r\n        return null;\r\n    }\r\n\r\n    \/\/\u6cdb\u578b\u65b9\u6cd5\r\n    \/\/\u4e3e\u4f8b\uff1a\u83b7\u53d6\u8868\u4e2d\u4e00\u5171\u6709\u591a\u5c11\u6761\u8bb0\u5f55\uff1f\u83b7\u53d6\u6700\u5927\u7684\u5458\u5de5\u5165\u804c\u65f6\u95f4\uff1f\r\n    public &lt;E> E getValue(){\r\n\r\n        return null;\r\n    }\r\n}\r\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>package top.qaqaq.java.P571;\r\n\r\nimport org.junit.jupiter.api.Test;\r\n\r\nimport java.util.List;\r\n\r\n\/**\r\n * @author RichieZhang\r\n * @create 2022-10-28 \u4e0b\u5348 9:20\r\n *\/\r\npublic class DAOTest {\r\n\r\n    @Test\r\n    public void test1(){\r\n        CustomerDAO dao1 = new CustomerDAO();\r\n\r\n        dao1.add(new Customer());\r\n        List&lt;Customer> list = dao1.getForList(10);\r\n\r\n        StudentDAO dao2 = new StudentDAO();\r\n        Student student = dao2.getIndex(1);\r\n\r\n\r\n\r\n    }\r\n}\r\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>package top.qaqaq.java.P571;\r\n\r\n\/**\r\n * @author RichieZhang\r\n * @create 2022-10-28 \u4e0b\u5348 9:15\r\n *\/\r\npublic class Customer { \/\/\u6b64\u7c7b\u5bf9\u5e94\u6570\u636e\u5e93\u4e2d\u7684customers\u8868\r\n}\r\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>package top.qaqaq.java.P571;\r\n\r\n\/**\r\n * @author RichieZhang\r\n * @create 2022-10-28 \u4e0b\u5348 9:16\r\n *\/\r\npublic class CustomerDAO extends DAO&lt;Customer>{\/\/\u53ea\u80fd\u64cd\u4f5c\u67d0\u4e00\u4e2a\u8868\u7684DAO\r\n}\r\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>package top.qaqaq.java.P571;\r\n\r\n\/**\r\n * @author RichieZhang\r\n * @create 2022-10-28 \u4e0b\u5348 9:24\r\n *\/\r\npublic class Student {\r\n}\r\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>package top.qaqaq.java.P571;\r\n\r\n\/**\r\n * @author RichieZhang\r\n * @create 2022-10-28 \u4e0b\u5348 9:24\r\n *\/\r\npublic class StudentDAO extends DAO&lt;Student> {\/\/\u53ea\u80fd\u64cd\u4f5c\u67d0\u4e00\u4e2a\u8868\u7684DAO\r\n\r\n}\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[46],"class_list":["post-1263","post","type-post","status-publish","format-standard","hentry","category-java-code","tag-java"],"_links":{"self":[{"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/posts\/1263"}],"collection":[{"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/qaqaq.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1263"}],"version-history":[{"count":1,"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/posts\/1263\/revisions"}],"predecessor-version":[{"id":1264,"href":"https:\/\/qaqaq.top\/index.php?rest_route=\/wp\/v2\/posts\/1263\/revisions\/1264"}],"wp:attachment":[{"href":"https:\/\/qaqaq.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1263"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/qaqaq.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1263"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/qaqaq.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1263"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}