mirror of
https://github.com/HighCapable/YukiReflection.git
synced 2025-09-10 04:24:03 +08:00
11 lines
6.9 KiB
JavaScript
11 lines
6.9 KiB
JavaScript
import{_ as r,r as s,o as c,c as d,b as e,d as o,e as l,w as a}from"./app-Un_zyw_U.js";const u={},p=e("h1",{id:"introduce",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#introduce","aria-hidden":"true"},"#"),o(" Introduce")],-1),h=e("blockquote",null,[e("p",null,[e("code",null,"YukiReflection"),o(" is a Reflection API based on the Java and Android platform.")])],-1),m=e("h2",{id:"background",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#background","aria-hidden":"true"},"#"),o(" Background")],-1),y=e("p",null,"This is a set of simple and efficient Reflection API rebuilt based on Java native Reflection API using Kotlin.",-1),A=e("code",null,"YukiReflection",-1),_={href:"https://github.com/HighCapable/YukiHookAPI",target:"_blank",rel:"noopener noreferrer"},f={href:"https://www.bilibili.com/bangumi/play/ss5016",target:"_blank",rel:"noopener noreferrer"},D=e("h2",{id:"usage",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#usage","aria-hidden":"true"},"#"),o(" Usage")],-1),b=e("p",null,[e("code",null,"YukiReflection"),o(" is fully built with Kotlin "),e("strong",null,"lambda"),o(" syntax.")],-1),B={href:"https://www.oracle.com/technical-resources/articles/java/javareflection.html",target:"_blank",rel:"noopener noreferrer"},C=e("h2",{id:"language-requirement",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#language-requirement","aria-hidden":"true"},"#"),o(" Language Requirement")],-1),g=e("p",null,[o("Please use Kotlin, the code composition of the API part is also compatible with Java, but the implementation of the basic reflection scene "),e("strong",null,"may not be used at all"),o(".")],-1),k=e("p",null,[o("All Demo sample codes in the document will be described using Kotlin, if you don’t know how to use Kotlin at all, you may not be able to use "),e("code",null,"YukiReflection"),o(".")],-1),F=e("h2",{id:"source-of-inspiration",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#source-of-inspiration","aria-hidden":"true"},"#"),o(" Source of Inspiration")],-1),v=e("code",null,"YukiReflection",-1),w={href:"https://github.com/HighCapable/YukiHookAPI",target:"_blank",rel:"noopener noreferrer"},x=e("p",null,"Now, we only need to write a small amount of code to implement a simple reflection call.",-1),I=e("p",null,[o("With Kotlin elegant "),e("strong",null,"lambda"),o(" and "),e("code",null,"YukiReflection"),o(", you can make your reflection logic more beautiful and clear.")],-1),R=e("blockquote",null,[e("p",null,"The following example")],-1),P=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"}},"()")]),o(`
|
||
`),e("span",{class:"line"},[e("span",{style:{color:"#ADBAC7"}}," ."),e("span",{style:{color:"#DCBDFB"}},"method"),e("span",{style:{color:"#ADBAC7"}}," {")]),o(`
|
||
`),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"')]),o(`
|
||
`),e("span",{class:"line"},[e("span",{style:{color:"#ADBAC7"}}," "),e("span",{style:{color:"#DCBDFB"}},"param"),e("span",{style:{color:"#ADBAC7"}},"(StringClass, StringClass)")]),o(`
|
||
`),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"}},")")]),o(`
|
||
`),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),Y=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"}},")")]),o(`
|
||
`),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)")]),o(`
|
||
`),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"}}," }")]),o(`
|
||
`),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"}},")")]),o(`
|
||
`),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 K(S,j){const n=s("ExternalLinkIcon"),t=s("CodeGroupItem"),i=s("CodeGroup");return c(),d("div",null,[p,h,m,y,e("p",null,[A,o(" is also the core functionality that "),e("a",_,[o("YukiHookAPI"),l(n)]),o(" is using.")]),e("p",null,[o("The name is taken from "),e("a",f,[o('"ももくり" heroine Yuki Kurihara'),l(n)]),o(".")]),D,b,e("p",null,[o("It can replace "),e("a",B,[o("Java's native Reflection API"),l(n)]),o(" and implement a more complete reflection solution in a more human-friendly language.")]),C,g,k,F,e("p",null,[v,o(" was originally the core function integrated in the "),e("a",w,[o("YukiHookAPI"),l(n)]),o(" project, and now it is decoupled so that this Reflection API can be used in any Java and Android platform project.")]),x,I,R,l(i,null,{default:a(()=>[l(t,{title:"Yuki Reflection"},{default:a(()=>[P]),_:1}),l(t,{title:"Java Reflection"},{default:a(()=>[Y]),_:1})]),_:1})])}const J=r(u,[["render",K],["__file","home.html.vue"]]);export{J as default};
|