{"id":1175,"date":"2012-12-03T17:47:44","date_gmt":"2012-12-03T09:47:44","guid":{"rendered":"http:\/\/www.strongd.net\/?p=1175"},"modified":"2012-12-03T17:47:44","modified_gmt":"2012-12-03T09:47:44","slug":"ant-build-java-generics%ef%bc%8cant%e7%bc%96%e8%af%91%e6%b3%9b%e5%9e%8b","status":"publish","type":"post","link":"https:\/\/www.strongd.net\/?p=1175","title":{"rendered":"ant build java generics\uff0cANT\u7f16\u8bd1\u6cdb\u578b"},"content":{"rendered":"<p>\u7528ant\u7f16\u8bd1java\u9879\u76ee\u7684\uff0c\u62a5\u6cdb\u578b\u9519\u8bef\uff0c\u4f46eclipse\u5374\u6ca1\u6709\u62a5\u9519\uff1b\u62a5\u9519\u5982\u4e0b\uff1a<\/p>\n<p>ScopeUtil.java:185:\u00a0type\u00a0parameters\u00a0of\u00a0&lt;T&gt;T\u00a0cannot\u00a0be\u00a0determined;\u00a0no\u00a0unique\u00a0maximal\u00a0instance\u00a0exists\u00a0for\u00a0type\u00a0variable\u00a0T\u00a0with\u00a0upper\u00a0bounds\u00a0boolean,java.lang.Object<\/p>\n<p><span style=\"color: #555555; background-color: #eeeeee;\">\u4ee3\u7801\u5982\u4e0b \uff1a\u00a0<\/span><\/p>\n<blockquote><p><span style=\"line-height: 19px;\">public\u00a0static\u00a0final\u00a0boolean\u00a0isSuperAdmin()\u00a0{<br \/>\n<\/span><span style=\"line-height: 19px;\">\u00a0 \u00a0return\u00a0getSession(key_SuperAdmin);<br \/>\n<\/span><span style=\"line-height: 19px;\">}<\/span><\/p>\n<div>\n@SuppressWarnings(&#8220;unchecked&#8221;)<br \/>\npublic\u00a0static\u00a0final\u00a0&lt;T&gt;\u00a0T\u00a0getSession(String\u00a0name)\u00a0{<br \/>\nActionContext\u00a0actionContext\u00a0=\u00a0ActionContext.getContext();<br \/>\nMap&lt;String,\u00a0Object&gt;\u00a0session\u00a0=\u00a0actionContext.getSession();<br \/>\nreturn\u00a0(T)\u00a0session.get(name);<br \/>\n}<\/div>\n<\/blockquote>\n<p>\u7ecf\u8fc7\u5206\u6790\uff0c\u53d1\u73b0isSuperAdmin\u8fd4\u56de\u662fboolean\u800cgetSession\uff0c\u8fd4\u56de\u662fBoolean\uff0c\u65e2\u8fd4\u56de\u5bf9\u8c61\u4e0e\u8fd4\u56de\u7c7b\u578b\u7684\u533a\u522b\uff0c\u6240\u4ee5\u5728ant\u7f16\u8bd1\u65f6\u51fa\u9519\uff1b<\/p>\n<p>\u628a\u4ee3\u7801\u6539\u4e00\u4e0b\u5c31\u53ef\u4ee5\u4e86\uff1a<\/p>\n<blockquote>\n<div>public\u00a0static\u00a0final\u00a0boolean\u00a0isSuperAdmin()\u00a0{<br \/>\nBoolean\u00a0superAdmin\u00a0=\u00a0getSession(key_SuperAdmin);<br \/>\nreturn\u00a0superAdmin\u00a0==\u00a0true;<br \/>\n}<\/div>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u7528ant\u7f16\u8bd1java\u9879\u76ee\u7684\uff0c\u62a5\u6cdb\u578b\u9519\u8bef\uff0c\u4f46eclipse\u5374\u6ca1\u6709\u62a5\u9519\uff1b\u62a5\u9519\u5982\u4e0b\uff1a ScopeUtil.java:185:\u00a0type\u00a0parameters\u00a0of\u00a0&lt;T&gt;T\u00a0cannot\u00a0be\u00a0determined;\u00a0no\u00a0unique\u00a0maximal\u00a0instance\u00a0exists\u00a0for\u00a0type\u00a0variable\u00a0T\u00a0with\u00a0upper\u00a0bounds\u00a0boolean,java.lang.Object \u4ee3\u7801\u5982\u4e0b \uff1a\u00a0 public\u00a0static\u00a0final\u00a0boolean\u00a0isSuperAdmin()\u00a0{ \u00a0 \u00a0return\u00a0getSession(key_SuperAdmin); } @SuppressWarnings(&#8220;unchecked&#8221;) public\u00a0static\u00a0final\u00a0&lt;T&gt;\u00a0T\u00a0getSession(String\u00a0name)\u00a0{ ActionContext\u00a0actionContext\u00a0=\u00a0ActionContext.getContext(); Map&lt;String,\u00a0Object&gt;\u00a0session\u00a0=\u00a0actionContext.getSession(); return\u00a0(T)\u00a0session.get(name); } \u7ecf\u8fc7\u5206\u6790\uff0c\u53d1\u73b0isSuperAdmin\u8fd4\u56de\u662fboolean\u800cgetSession\uff0c\u8fd4\u56de\u662fBoolean\uff0c\u65e2\u8fd4\u56de\u5bf9\u8c61\u4e0e\u8fd4\u56de\u7c7b\u578b\u7684\u533a\u522b\uff0c\u6240\u4ee5\u5728ant\u7f16\u8bd1\u65f6\u51fa\u9519\uff1b \u628a\u4ee3\u7801\u6539\u4e00\u4e0b\u5c31\u53ef\u4ee5\u4e86\uff1a public\u00a0static\u00a0final\u00a0boolean\u00a0isSuperAdmin()\u00a0{ Boolean\u00a0superAdmin\u00a0=\u00a0getSession(key_SuperAdmin); return\u00a0superAdmin\u00a0==\u00a0true; }<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[191,9],"class_list":["post-1175","post","type-post","status-publish","format-standard","hentry","category-java","tag-ant","tag-java-2"],"_links":{"self":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/1175","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1175"}],"version-history":[{"count":1,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/1175\/revisions"}],"predecessor-version":[{"id":1176,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/1175\/revisions\/1176"}],"wp:attachment":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1175"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1175"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1175"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}