{"id":31309,"date":"2023-12-17T07:17:10","date_gmt":"2023-05-29T19:30:12","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90java%e3%80%91%e8%8e%b7%e5%8f%96method-constructor%e8%bf%94%e5%9b%9e%e7%9a%84kfunction%e3%80%90kotlin%e3%80%91\/"},"modified":"2025-08-12T23:22:08","modified_gmt":"2025-08-12T15:22:08","slug":"%e3%80%90java%e3%80%91%e8%8e%b7%e5%8f%96method-constructor%e8%bf%94%e5%9b%9e%e7%9a%84kfunction%e3%80%90kotlin%e3%80%91","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90java%e3%80%91%e8%8e%b7%e5%8f%96method-constructor%e8%bf%94%e5%9b%9e%e7%9a%84kfunction%e3%80%90kotlin%e3%80%91\/","title":{"rendered":"\u3010Java\u3011\u83b7\u53d6Method\/Constructor\u8fd4\u56de\u7684KFunction\u3010Kotlin\u3011"},"content":{"rendered":"<h1>\u8981\u505a\u7684\u4e8b zu\u00f2 de sh\u00ec)<\/h1>\n<p>\u4eceJava\u7684Method\/Constructor\u4e2d\u63d0\u53d6\u51faKFunction\u3002<\/p>\n<h1>\u505a\u6cd5<\/h1>\n<p>\u53ea\u9700\u4eceJava\u4e2d\u8c03\u7528Method.kotlinFunction\/Constructor.kotlinFunction\uff0c\u5c31\u53ef\u4ee5\u5b8c\u6210\u4ee5\u4e0b\u64cd\u4f5c\u3002<\/p>\n<ul class=\"post-ul\">kotlin\/ReflectJvmMapping.kt at master \u00b7 JetBrains\/kotlin<\/ul>\n<p>\u5177\u4f53\u6765\u8bf4\uff0c\u60c5\u51b5\u5982\u4e0b\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nc\">KFunction<\/span><span class=\"o\">&lt;?&gt;<\/span> <span class=\"n\">function<\/span> <span class=\"o\">=<\/span> <span class=\"nc\">ReflectJvmMapping<\/span><span class=\"o\">.<\/span><span class=\"na\">getKotlinFunction<\/span><span class=\"o\">(<\/span><span class=\"nc\">Foo<\/span><span class=\"o\">.<\/span><span class=\"na\">class<\/span><span class=\"o\">.<\/span><span class=\"na\">getConstructors<\/span><span class=\"o\">()[<\/span><span class=\"mi\">0<\/span><span class=\"o\">]);<\/span>\r\n<\/code><\/pre>\n<h2>\u7559\u5fc3\u4e8b\u9879<\/h2>\n<p>\u7531\u4e8e\u4eceClass\u83b7\u53d6Method\/Constructor\u65f6\u5f88\u5c11\u8bbe\u7f6e\u6cdb\u578b\u7c7b\u578b\u53c2\u6570\uff0c\u5982\u679c\u60f3\u8981\u8bbe\u7f6e\u7c7b\u578b\u53c2\u6570\uff0c\u5219\u9700\u8981\u5728Java\u4e2d\u8fdb\u884c\u7c7b\u578b\u8f6c\u6362\u3002<\/p>\n<pre class=\"post-pre\"><code><span class=\"nc\">KFunction<\/span><span class=\"o\">&lt;<\/span><span class=\"nc\">Foo<\/span><span class=\"o\">&gt;<\/span> <span class=\"n\">function<\/span> <span class=\"o\">=<\/span> <span class=\"nc\">ReflectJvmMapping<\/span><span class=\"o\">.<\/span><span class=\"na\">getKotlinFunction<\/span><span class=\"o\">((<\/span><span class=\"nc\">Constructor<\/span><span class=\"o\">&lt;<\/span><span class=\"nc\">Foo<\/span><span class=\"o\">&gt;)<\/span> <span class=\"nc\">Foo<\/span><span class=\"o\">.<\/span><span class=\"na\">class<\/span><span class=\"o\">.<\/span><span class=\"na\">getConstructors<\/span><span class=\"o\">()[<\/span><span class=\"mi\">0<\/span><span class=\"o\">]);<\/span>\r\n<\/code><\/pre>\n<h1>\u6211\u53c2\u8003\u4e86\u4e00\u7bc7\u6587\u7ae0\u3002<\/h1>\n<ul class=\"post-ul\">kotlin.reflect.KFunction java code examples | Codota<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u8981\u505a\u7684\u4e8b zu\u00f2 de sh\u00ec) \u4eceJava\u7684Method\/Constructor\u4e2d\u63d0\u53d6\u51faKFunction\u3002 [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[227],"class_list":["post-31309","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-227"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u3010Java\u3011\u83b7\u53d6Method\/Constructor\u8fd4\u56de\u7684KFunction\u3010Kotlin\u3011 - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"\u5173\u4e8e\u3010Java\u3011\u83b7\u53d6Method\/Constructor\u8fd4\u56de\u7684KFunction\u3010Kotlin\u3011\u7684\u6280\u672f\u6587\u7ae0\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/\u3010java\u3011\u83b7\u53d6method-constructor\u8fd4\u56de\u7684kfunction\u3010kotlin\u3011\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010Java\u3011\u83b7\u53d6Method\/Constructor\u8fd4\u56de\u7684KFunction\u3010Kotlin\u3011\" \/>\n<meta property=\"og:description\" content=\"\u5173\u4e8e\u3010Java\u3011\u83b7\u53d6Method\/Constructor\u8fd4\u56de\u7684KFunction\u3010Kotlin\u3011\u7684\u6280\u672f\u6587\u7ae0\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/\u3010java\u3011\u83b7\u53d6method-constructor\u8fd4\u56de\u7684kfunction\u3010kotlin\u3011\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-05-29T19:30:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-12T15:22:08+00:00\" \/>\n<meta name=\"author\" content=\"\u6587, \u7fd4\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u6587, \u7fd4\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90java%e3%80%91%e8%8e%b7%e5%8f%96method-constructor%e8%bf%94%e5%9b%9e%e7%9a%84kfunction%e3%80%90kotlin%e3%80%91\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90java%e3%80%91%e8%8e%b7%e5%8f%96method-constructor%e8%bf%94%e5%9b%9e%e7%9a%84kfunction%e3%80%90kotlin%e3%80%91\/\",\"name\":\"\u3010Java\u3011\u83b7\u53d6Method\/Constructor\u8fd4\u56de\u7684KFunction\u3010Kotlin\u3011 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-05-29T19:30:12+00:00\",\"dateModified\":\"2025-08-12T15:22:08+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/64d5cc7727fffbff2f9a2a8da1de3e5c\"},\"description\":\"\u5173\u4e8e\u3010Java\u3011\u83b7\u53d6Method\/Constructor\u8fd4\u56de\u7684KFunction\u3010Kotlin\u3011\u7684\u6280\u672f\u6587\u7ae0\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90java%e3%80%91%e8%8e%b7%e5%8f%96method-constructor%e8%bf%94%e5%9b%9e%e7%9a%84kfunction%e3%80%90kotlin%e3%80%91\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90java%e3%80%91%e8%8e%b7%e5%8f%96method-constructor%e8%bf%94%e5%9b%9e%e7%9a%84kfunction%e3%80%90kotlin%e3%80%91\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90java%e3%80%91%e8%8e%b7%e5%8f%96method-constructor%e8%bf%94%e5%9b%9e%e7%9a%84kfunction%e3%80%90kotlin%e3%80%91\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010Java\u3011\u83b7\u53d6Method\/Constructor\u8fd4\u56de\u7684KFunction\u3010Kotlin\u3011\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/64d5cc7727fffbff2f9a2a8da1de3e5c\",\"name\":\"\u6587, \u7fd4\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/920c3d673e0bccacc98e5e6b7149bb3c22edd8d39cb753e5d7d7e471498118a1?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/920c3d673e0bccacc98e5e6b7149bb3c22edd8d39cb753e5d7d7e471498118a1?s=96&d=mm&r=g\",\"caption\":\"\u6587, \u7fd4\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/wenxiang\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90java%e3%80%91%e8%8e%b7%e5%8f%96method-constructor%e8%bf%94%e5%9b%9e%e7%9a%84kfunction%e3%80%90kotlin%e3%80%91\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"\u3010Java\u3011\u83b7\u53d6Method\/Constructor\u8fd4\u56de\u7684KFunction\u3010Kotlin\u3011 - Blog - Silicon Cloud","description":"\u5173\u4e8e\u3010Java\u3011\u83b7\u53d6Method\/Constructor\u8fd4\u56de\u7684KFunction\u3010Kotlin\u3011\u7684\u6280\u672f\u6587\u7ae0","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/\u3010java\u3011\u83b7\u53d6method-constructor\u8fd4\u56de\u7684kfunction\u3010kotlin\u3011\/","og_locale":"zh_CN","og_type":"article","og_title":"\u3010Java\u3011\u83b7\u53d6Method\/Constructor\u8fd4\u56de\u7684KFunction\u3010Kotlin\u3011","og_description":"\u5173\u4e8e\u3010Java\u3011\u83b7\u53d6Method\/Constructor\u8fd4\u56de\u7684KFunction\u3010Kotlin\u3011\u7684\u6280\u672f\u6587\u7ae0","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/\u3010java\u3011\u83b7\u53d6method-constructor\u8fd4\u56de\u7684kfunction\u3010kotlin\u3011\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-05-29T19:30:12+00:00","article_modified_time":"2025-08-12T15:22:08+00:00","author":"\u6587, \u7fd4","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u6587, \u7fd4","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90java%e3%80%91%e8%8e%b7%e5%8f%96method-constructor%e8%bf%94%e5%9b%9e%e7%9a%84kfunction%e3%80%90kotlin%e3%80%91\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90java%e3%80%91%e8%8e%b7%e5%8f%96method-constructor%e8%bf%94%e5%9b%9e%e7%9a%84kfunction%e3%80%90kotlin%e3%80%91\/","name":"\u3010Java\u3011\u83b7\u53d6Method\/Constructor\u8fd4\u56de\u7684KFunction\u3010Kotlin\u3011 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-05-29T19:30:12+00:00","dateModified":"2025-08-12T15:22:08+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/64d5cc7727fffbff2f9a2a8da1de3e5c"},"description":"\u5173\u4e8e\u3010Java\u3011\u83b7\u53d6Method\/Constructor\u8fd4\u56de\u7684KFunction\u3010Kotlin\u3011\u7684\u6280\u672f\u6587\u7ae0","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90java%e3%80%91%e8%8e%b7%e5%8f%96method-constructor%e8%bf%94%e5%9b%9e%e7%9a%84kfunction%e3%80%90kotlin%e3%80%91\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90java%e3%80%91%e8%8e%b7%e5%8f%96method-constructor%e8%bf%94%e5%9b%9e%e7%9a%84kfunction%e3%80%90kotlin%e3%80%91\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90java%e3%80%91%e8%8e%b7%e5%8f%96method-constructor%e8%bf%94%e5%9b%9e%e7%9a%84kfunction%e3%80%90kotlin%e3%80%91\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"\u3010Java\u3011\u83b7\u53d6Method\/Constructor\u8fd4\u56de\u7684KFunction\u3010Kotlin\u3011"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/64d5cc7727fffbff2f9a2a8da1de3e5c","name":"\u6587, \u7fd4","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/920c3d673e0bccacc98e5e6b7149bb3c22edd8d39cb753e5d7d7e471498118a1?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/920c3d673e0bccacc98e5e6b7149bb3c22edd8d39cb753e5d7d7e471498118a1?s=96&d=mm&r=g","caption":"\u6587, \u7fd4"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/wenxiang\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/%e3%80%90java%e3%80%91%e8%8e%b7%e5%8f%96method-constructor%e8%bf%94%e5%9b%9e%e7%9a%84kfunction%e3%80%90kotlin%e3%80%91\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/31309","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=31309"}],"version-history":[{"count":2,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/31309\/revisions"}],"predecessor-version":[{"id":98734,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/31309\/revisions\/98734"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=31309"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=31309"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=31309"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}