mirror of
https://github.com/HighCapable/YukiReflection.git
synced 2025-09-10 04:24:03 +08:00
11 lines
6.7 KiB
JavaScript
11 lines
6.7 KiB
JavaScript
import{_ as c,r as n,o as i,c as d,b as e,d as l,e as s,w as a}from"./app-Un_zyw_U.js";const p={},u=e("h1",{id:"介绍",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#介绍","aria-hidden":"true"},"#"),l(" 介绍")],-1),h=e("blockquote",null,[e("p",null,[e("code",null,"YukiReflection"),l(" 是一个基于 Java 和 Android 平台的反射 API。")])],-1),A=e("h2",{id:"背景",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#背景","aria-hidden":"true"},"#"),l(" 背景")],-1),_=e("p",null,"这是一个使用 Kotlin 基于 Java 原生反射 API 重新打造的一套简洁、高效的反射 API。",-1),D=e("code",null,"YukiReflection",-1),y={href:"https://github.com/HighCapable/YukiHookAPI",target:"_blank",rel:"noopener noreferrer"},B={href:"https://www.bilibili.com/bangumi/play/ss5016",target:"_blank",rel:"noopener noreferrer"},C=e("h2",{id:"用途",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#用途","aria-hidden":"true"},"#"),l(" 用途")],-1),m=e("p",null,[e("code",null,"YukiReflection"),l(" 完全采用 Kotlin "),e("strong",null,"lambda"),l(" 语法构建。")],-1),b={href:"https://pdai.tech/md/java/basic/java-basic-x-reflection.html",target:"_blank",rel:"noopener noreferrer"},k=e("h2",{id:"语言要求",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#语言要求","aria-hidden":"true"},"#"),l(" 语言要求")],-1),f=e("p",null,[l("请使用 Kotlin,API 部分代码构成同样兼容 Java 但基础反射场景的实现"),e("strong",null,"可能完全无法使用"),l("。")],-1),F=e("p",null,[l("文档全部的 Demo 示例代码都将使用 Kotlin 进行描述,如果你完全不会使用 Kotlin 那你将有可能无法使用 "),e("code",null,"YukiReflection"),l("。")],-1),g=e("h2",{id:"灵感来源",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#灵感来源","aria-hidden":"true"},"#"),l(" 灵感来源")],-1),v=e("code",null,"YukiReflection",-1),x={href:"https://github.com/HighCapable/YukiHookAPI",target:"_blank",rel:"noopener noreferrer"},I=e("p",null,"现在,我们只需要编写少量的代码,就能实现一个简单的反射调用。",-1),P=e("p",null,[l("借助 Kotlin 优雅的 "),e("strong",null,"lambda"),l(" 写法以及 "),e("code",null,"YukiReflection"),l(",可以让你的反射逻辑更加美观清晰。")],-1),Y=e("blockquote",null,[e("p",null,"示例如下")],-1),R=e("div",{class:"language-kotlin line-numbers-mode","data-ext":"kt"},[e("pre",{class:"shiki github-dark-dimmed",style:{"background-color":"#22272e"},tabindex:"0"},[e("code",null,[e("span",{class:"line"},[e("span",{style:{color:"#96D0FF"}},'"android.os.SystemProperties"'),e("span",{style:{color:"#ADBAC7"}},"."),e("span",{style:{color:"#DCBDFB"}},"toClass"),e("span",{style:{color:"#ADBAC7"}},"()")]),l(`
|
||
`),e("span",{class:"line"},[e("span",{style:{color:"#ADBAC7"}}," ."),e("span",{style:{color:"#DCBDFB"}},"method"),e("span",{style:{color:"#ADBAC7"}}," {")]),l(`
|
||
`),e("span",{class:"line"},[e("span",{style:{color:"#ADBAC7"}}," name "),e("span",{style:{color:"#F47067"}},"="),e("span",{style:{color:"#ADBAC7"}}," "),e("span",{style:{color:"#96D0FF"}},'"get"')]),l(`
|
||
`),e("span",{class:"line"},[e("span",{style:{color:"#ADBAC7"}}," "),e("span",{style:{color:"#DCBDFB"}},"param"),e("span",{style:{color:"#ADBAC7"}},"(StringClass, StringClass)")]),l(`
|
||
`),e("span",{class:"line"},[e("span",{style:{color:"#ADBAC7"}}," }."),e("span",{style:{color:"#DCBDFB"}},"get"),e("span",{style:{color:"#ADBAC7"}},"()."),e("span",{style:{color:"#DCBDFB"}},"call"),e("span",{style:{color:"#ADBAC7"}},"("),e("span",{style:{color:"#96D0FF"}},'"ro.system.build.fingerprint"'),e("span",{style:{color:"#ADBAC7"}},", "),e("span",{style:{color:"#96D0FF"}},'"none"'),e("span",{style:{color:"#ADBAC7"}},")")]),l(`
|
||
`),e("span",{class:"line"})])]),e("div",{class:"line-numbers","aria-hidden":"true"},[e("div",{class:"line-number"}),e("div",{class:"line-number"}),e("div",{class:"line-number"}),e("div",{class:"line-number"}),e("div",{class:"line-number"})])],-1),H=e("div",{class:"language-kotlin line-numbers-mode","data-ext":"kt"},[e("pre",{class:"shiki github-dark-dimmed",style:{"background-color":"#22272e"},tabindex:"0"},[e("code",null,[e("span",{class:"line"},[e("span",{style:{color:"#ADBAC7"}},"Class."),e("span",{style:{color:"#DCBDFB"}},"forName"),e("span",{style:{color:"#ADBAC7"}},"("),e("span",{style:{color:"#96D0FF"}},'"android.os.SystemProperties"'),e("span",{style:{color:"#ADBAC7"}},")")]),l(`
|
||
`),e("span",{class:"line"},[e("span",{style:{color:"#ADBAC7"}}," ."),e("span",{style:{color:"#DCBDFB"}},"getDeclaredMethod"),e("span",{style:{color:"#ADBAC7"}},"("),e("span",{style:{color:"#96D0FF"}},'"get"'),e("span",{style:{color:"#ADBAC7"}},", String::"),e("span",{style:{color:"#DCBDFB"}},"class"),e("span",{style:{color:"#ADBAC7"}},".java, String::"),e("span",{style:{color:"#DCBDFB"}},"class"),e("span",{style:{color:"#ADBAC7"}},".java)")]),l(`
|
||
`),e("span",{class:"line"},[e("span",{style:{color:"#ADBAC7"}}," ."),e("span",{style:{color:"#DCBDFB"}},"apply"),e("span",{style:{color:"#ADBAC7"}}," { isAccessible "),e("span",{style:{color:"#F47067"}},"="),e("span",{style:{color:"#ADBAC7"}}," "),e("span",{style:{color:"#6CB6FF"}},"true"),e("span",{style:{color:"#ADBAC7"}}," }")]),l(`
|
||
`),e("span",{class:"line"},[e("span",{style:{color:"#ADBAC7"}}," ."),e("span",{style:{color:"#DCBDFB"}},"invoke"),e("span",{style:{color:"#ADBAC7"}},"("),e("span",{style:{color:"#6CB6FF"}},"null"),e("span",{style:{color:"#ADBAC7"}},", "),e("span",{style:{color:"#96D0FF"}},'"ro.system.build.fingerprint"'),e("span",{style:{color:"#ADBAC7"}},", "),e("span",{style:{color:"#96D0FF"}},'"none"'),e("span",{style:{color:"#ADBAC7"}},")")]),l(`
|
||
`),e("span",{class:"line"})])]),e("div",{class:"line-numbers","aria-hidden":"true"},[e("div",{class:"line-number"}),e("div",{class:"line-number"}),e("div",{class:"line-number"}),e("div",{class:"line-number"})])],-1);function J(K,S){const o=n("ExternalLinkIcon"),t=n("CodeGroupItem"),r=n("CodeGroup");return i(),d("div",null,[u,h,A,_,e("p",null,[D,l(" 同时也是 "),e("a",y,[l("YukiHookAPI"),s(o)]),l(" 正在使用的核心功能。")]),e("p",null,[l("名称取自 "),e("a",B,[l("《ももくり》女主 栗原 雪(Yuki)"),s(o)]),l("。")]),C,m,e("p",null,[l("它能取代 "),e("a",b,[l("Java 原生的反射 API"),s(o)]),l(",使用更加人性化的语言实现一套更加完善的反射方案。")]),k,f,F,g,e("p",null,[v,l(" 最初是集成在 "),e("a",x,[l("YukiHookAPI"),s(o)]),l(" 项目中的核心功能,现在进行了解耦合,使得这套反射 API 可以在任何 Java 和 Android 平台的项目中使用。")]),I,P,Y,s(r,null,{default:a(()=>[s(t,{title:"Yuki Reflection"},{default:a(()=>[R]),_:1}),s(t,{title:"Java Reflection"},{default:a(()=>[H]),_:1})]),_:1})])}const j=c(p,[["render",J],["__file","home.html.vue"]]);export{j as default};
|