import{_ as c,r as p,o as i,c as r,b as n,d as s,e,w as o,a}from"./app-OEUYI7Bq.js";const d={},y=a(`<h1 id="kavaref-core" tabindex="-1"><a class="header-anchor" href="#kavaref-core" aria-hidden="true">#</a> kavaref-core</h1><p><img src="https://img.shields.io/maven-central/v/com.highcapable.kavaref/kavaref-core?logo=apachemaven&amp;logoColor=orange&amp;style=flat-square" alt="Maven Central"><span style="margin-left:5px;"></span><img src="https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Fraw.githubusercontent.com%2FHighCapable%2Fmaven-repository%2Frefs%2Fheads%2Fmain%2Frepository%2Freleases%2Fcom%2Fhighcapable%2Fkavaref%2Fkavaref-core%2Fmaven-metadata.xml&amp;logo=apachemaven&amp;logoColor=orange&amp;label=highcapable-maven-releases&amp;style=flat-square" alt="Maven metadata URL"></p><p>This is the core dependency of KavaRef, and you need to introduce this module to use the basic features of KavaRef.</p><h2 id="configure-dependency" tabindex="-1"><a class="header-anchor" href="#configure-dependency" aria-hidden="true">#</a> Configure Dependency</h2><p>You can add this module to your project using the following method.</p><h3 id="version-catalog-recommended" tabindex="-1"><a class="header-anchor" href="#version-catalog-recommended" aria-hidden="true">#</a> Version Catalog (Recommended)</h3><p>Add dependency in your project&#39;s <code>gradle/libs.versions.toml</code>.</p><div class="language-toml line-numbers-mode" data-ext="toml"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#ADBAC7;">[</span><span style="color:#F69D50;">versions</span><span style="color:#ADBAC7;">]</span></span>
<span class="line"><span style="color:#ADBAC7;">kavaref-core = </span><span style="color:#96D0FF;">&quot;&lt;version&gt;&quot;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ADBAC7;">[</span><span style="color:#F69D50;">libraries</span><span style="color:#ADBAC7;">]</span></span>
<span class="line"><span style="color:#ADBAC7;">kavaref-core = { module = </span><span style="color:#96D0FF;">&quot;com.highcapable.kavaref:kavaref-core&quot;</span><span style="color:#ADBAC7;">, version.ref = </span><span style="color:#96D0FF;">&quot;kavaref-core&quot;</span><span style="color:#ADBAC7;"> }</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>Configure dependency in your project&#39;s <code>build.gradle.kts</code>.</p><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#DCBDFB;">implementation</span><span style="color:#ADBAC7;">(libs.kavaref.core)</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Please change <code>&lt;version&gt;</code> to the version displayed at the top of this document.</p><h3 id="traditional-method" tabindex="-1"><a class="header-anchor" href="#traditional-method" aria-hidden="true">#</a> Traditional Method</h3><p>Configure dependency in your project&#39;s <code>build.gradle.kts</code>.</p><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#DCBDFB;">implementation</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;com.highcapable.kavaref:kavaref-core:&lt;version&gt;&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Please change <code>&lt;version&gt;</code> to the version displayed at the top of this document.</p><h2 id="function-introduction" tabindex="-1"><a class="header-anchor" href="#function-introduction" aria-hidden="true">#</a> Function Introduction</h2>`,16),A={href:"https://highcapable.github.io/KavaRef/KDoc/kavaref-core",target:"_blank",rel:"noopener noreferrer"},u=a(`<h3 id="basic-usage" tabindex="-1"><a class="header-anchor" href="#basic-usage" aria-hidden="true">#</a> Basic Usage</h3><p>KavaRef adopts a chained call design, which creates extension methods for available Java reflection APIs (such as <code>Class</code>). You only need to call <code>resolve()</code> to these contents to enter the world of KavaRef.</p><p>The relationship diagram is as follows.</p><div class="language-text" data-ext="text"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#adbac7;">KavaRef</span></span>
<span class="line"><span style="color:#adbac7;">└── KClass/Class.resolve()</span></span>
<span class="line"><span style="color:#adbac7;">    ├── method()</span></span>
<span class="line"><span style="color:#adbac7;">    ├── constructor()</span></span>
<span class="line"><span style="color:#adbac7;">    └── field()</span></span>
<span class="line"><span style="color:#adbac7;"></span></span></code></pre></div><p>Next, we will give multiple examples of Java <code>Class</code>, which will be explained based on them in the future.</p><div class="language-java" data-ext="java"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#F47067;">package</span><span style="color:#ADBAC7;"> com.demo;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#F47067;">public</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">class</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">BaseTest</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F47067;">public</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">BaseTest</span><span style="color:#ADBAC7;">() {</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// ...</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F47067;">private</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">void</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">doBaseTask</span><span style="color:#ADBAC7;">(String </span><span style="color:#F69D50;">taskName</span><span style="color:#ADBAC7;">) {</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// ...</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"><span style="color:#ADBAC7;">}</span></span>
<span class="line"></span></code></pre></div><div class="language-java" data-ext="java"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#F47067;">package</span><span style="color:#ADBAC7;"> com.demo;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#F47067;">public</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">class</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">Test</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">extends</span><span style="color:#ADBAC7;"> </span><span style="color:#6CB6FF;">BaseTest</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F47067;">private</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">Test</span><span style="color:#ADBAC7;">() {</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// ...</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F47067;">private</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">static</span><span style="color:#ADBAC7;"> TAG </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;Test&quot;</span><span style="color:#ADBAC7;">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F47067;">private</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">boolean</span><span style="color:#F69D50;"> </span><span style="color:#ADBAC7;">isTaskRunning</span><span style="color:#F69D50;"> </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#6CB6FF;">false</span><span style="color:#ADBAC7;">;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F47067;">private</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">void</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">doTask</span><span style="color:#ADBAC7;">(String </span><span style="color:#F69D50;">taskName</span><span style="color:#ADBAC7;">) {</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// ...</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F47067;">private</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">void</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">release</span><span style="color:#ADBAC7;">(String </span><span style="color:#F69D50;">taskName</span><span style="color:#ADBAC7;">, Function&lt;</span><span style="color:#F47067;">boolean</span><span style="color:#ADBAC7;">, </span><span style="color:#F47067;">String</span><span style="color:#ADBAC7;">&gt; </span><span style="color:#F69D50;">task</span><span style="color:#ADBAC7;">, </span><span style="color:#F47067;">boolean</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">isFinish</span><span style="color:#ADBAC7;">) {</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// ...</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F47067;">private</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">void</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">stop</span><span style="color:#ADBAC7;">() {</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// ...</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F47067;">private</span><span style="color:#ADBAC7;"> String </span><span style="color:#DCBDFB;">getName</span><span style="color:#ADBAC7;">() {</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// ...</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"><span style="color:#ADBAC7;">}</span></span>
<span class="line"></span></code></pre></div><div class="language-java line-numbers-mode" data-ext="java"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#F47067;">public</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">class</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">Box</span><span style="color:#ADBAC7;">&lt;</span><span style="color:#F47067;">T</span><span style="color:#ADBAC7;">&gt; {</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F47067;">public</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">void</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">print</span><span style="color:#ADBAC7;">(T </span><span style="color:#F69D50;">item</span><span style="color:#ADBAC7;">, String </span><span style="color:#F69D50;">str</span><span style="color:#ADBAC7;">) {</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// ...</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"><span style="color:#ADBAC7;">}</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>Suppose we want to get the <code>doTask</code> method of <code>Test</code> and execute it. In KavaRef, you can do it in the following way.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#768390;">// Suppose this is an instance of this Class.</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> test: </span><span style="color:#F69D50;">Test</span></span>
<span class="line"><span style="color:#768390;">// Reflect it by instantiating Class.</span></span>
<span class="line"><span style="color:#768390;">// In KavaRef you don&#39;t need to convert it to \`java.lang.Class\`,</span></span>
<span class="line"><span style="color:#768390;">// it will automatically call KClass.java.</span></span>
<span class="line"><span style="color:#ADBAC7;">Test::</span><span style="color:#DCBDFB;">class</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// Create KavaRef reflections.</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">resolve</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// Create method condition.</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">method</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Set method name.</span></span>
<span class="line"><span style="color:#ADBAC7;">        name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;doTask&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Set method parameter type.</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#DCBDFB;">parameters</span><span style="color:#ADBAC7;">(String::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// After the condition is executed, the matching List&lt;MethodResolver&gt;</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// instance will be returned.</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// Here we get the first filtering result.</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">first</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// Set an instance of Test on MethodResolver.</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">of</span><span style="color:#ADBAC7;">(test)</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// Call the method and pass in parameters.</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">invoke</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;task_name&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>In the above writing method, we use <code>Test::class.resolve()</code> to get the KavaRef reflection instance of the current <code>Class</code>. Then create a method filtering condition <code>MethodCondition</code> using <code>method { ... }</code>, which sets the method name and parameter type, and returns the <code>List&lt;MethodResolver&gt;</code> instance after execution. Then we use <code>first()</code> to get the first matched <code>MethodResolver</code> instance, then use <code>of(test)</code> to set the current instance of <code>Class</code>, and finally use <code>invoke(&quot;task_name&quot;)</code> to execute the method and pass in the parameters.</p><p>In this, MethodCondition is inherited from MemberCondition, which allows you to conditionally filter the Method, containing a conditional image of the Java-core reflection API. You can view the corresponding comments to understand the native usage of each API.</p><p>Similarly, MethodResolver is inherited from <code>MemberResolver</code>, which allows you to make reflection calls to <code>Method</code> in the filtered result.</p><p>Since the reflection requirement here is to obtain an available method result, the call chain of <code>method { ... }.first()</code> may be more cumbersome, so there is the following simplified solution.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#ADBAC7;">Test::</span><span style="color:#DCBDFB;">class</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">resolve</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// Use firstMethod directly to get the first matching</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// MethodResolver instance.</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">firstMethod</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"><span style="color:#ADBAC7;">        name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;doTask&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#DCBDFB;">parameters</span><span style="color:#ADBAC7;">(String::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">of</span><span style="color:#ADBAC7;">(test)</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">invoke</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;task_name&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>Since we can now get an instance of <code>Test</code>, there is also a simplified way to write this: you can use this instance to create KavaRef reflections directly.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#768390;">// Here, the test instance test will be passed to</span></span>
<span class="line"><span style="color:#768390;">// KavaRef and get test::class.java.</span></span>
<span class="line"><span style="color:#ADBAC7;">test.</span><span style="color:#DCBDFB;">asResolver</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">firstMethod</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"><span style="color:#ADBAC7;">        name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;doTask&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#DCBDFB;">parameters</span><span style="color:#ADBAC7;">(String::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;">    } </span><span style="color:#768390;">// Since you set up an instance, of(test) is no longer needed here.</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">invoke</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;task_name&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>Next, we need to get the <code>isTaskRunning</code> variable, which can be written in the following form.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#768390;">// Suppose this is an instance of this Class.</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> test: </span><span style="color:#F69D50;">Test</span></span>
<span class="line"><span style="color:#768390;">// Call and execute with KavaRef.</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> isTaskRunning </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> test.</span><span style="color:#DCBDFB;">asResolver</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">firstField</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"><span style="color:#ADBAC7;">        name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;isTaskRunning&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;">        type </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> Boolean::</span><span style="color:#DCBDFB;">class</span></span>
<span class="line"><span style="color:#ADBAC7;">    }.</span><span style="color:#DCBDFB;">get</span><span style="color:#ADBAC7;">&lt;</span><span style="color:#F69D50;">Boolean</span><span style="color:#ADBAC7;">&gt;()</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>The constructor in <code>Test</code> is private, and now we can create an instance of it using the following method.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> test </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> Test::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">.</span><span style="color:#DCBDFB;">resolve</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">firstConstructor</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// For the zero parameter constructor,</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// the following condition can be used to filter.</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// It is equivalent to parameterCount = 0.</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#DCBDFB;">emptyParameters</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">    }.</span><span style="color:#DCBDFB;">create</span><span style="color:#ADBAC7;">() </span><span style="color:#768390;">// Create a new Test instance.</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>You can also use <code>createAsType&lt;T&gt;()</code> to specify its superclass type <code>BaseTest</code> for the actual object <code>Test</code>.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> test </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> Test::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">.</span><span style="color:#DCBDFB;">resolve</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">firstConstructor</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#DCBDFB;">emptyParameters</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">    }.</span><span style="color:#DCBDFB;">createAsType</span><span style="color:#ADBAC7;">&lt;</span><span style="color:#F69D50;">BaseTest</span><span style="color:#ADBAC7;">&gt;() </span><span style="color:#768390;">// Create a new BaseTest instance.</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><div class="custom-container tip"><p class="custom-container-title">Tips</p><p>In addition to methods such as <code>firstMethod</code>, you can also use methods such as <code>lastMethod</code> to get the last matching <code>MethodResolver</code> instance, which is equivalent to <code>method { ... }.last()</code>.</p><p>After you get the <code>MemberResolver</code> instance, you can use <code>self</code> to get the <code>Member</code> original instance of the current <code>MemberResolver</code> to do some of your own operations.</p><p>In <code>MemberResolver</code> inherited from <code>InstanceAwareResolver</code> (for example <code>MethodResolver</code> and <code>FieldResolver</code>), you can use <code>of(instance)</code> to set the current instance. If the reflection is a static member, you do not need to set the instance.</p></div><div class="custom-container warning"><p class="custom-container-title">Notice</p><p>The <code>Any.resolve()</code> function has been deprecated in version <code>1.0.1</code> because it pollutes the namespace (for example <code>File.resolve(&quot;/path/to/file&quot;)</code>), and now use <code>Any.asResolver()</code> instead.</p></div>`,31),D={class:"custom-container danger"},v=a(`<p class="custom-container-title">Pay Attention</p><p>In <code>MemberResolver</code> inherited from <code>InstanceAwareResolver</code>, the type of <code>of(instance)</code> requires the same type as the currently reflected <code>Class</code> instance generic type. Unless the <code>Class</code> generic type is not specified, or the <code>Class</code> generic type is set to <code>Any</code>.</p><p>If <code>of(instance)</code> shows a <code>Required: Nothing?</code> error (this is usually due to <code>Class</code> created via <code>Class.forName(...)</code> or <code>ClassLoader.loadClass(...)</code>), then your <code>Class</code> is <code>Class&lt;*&gt;</code> (in Java it is <code>Class&lt;?&gt;</code>). At this time, if you do not want to specify the type, please set or convert it to <code>Class&lt;Any&gt;</code>, as follows.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> myClass </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> Class.</span><span style="color:#DCBDFB;">forName</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;com.xxx.MyClass&quot;</span><span style="color:#ADBAC7;">) </span><span style="color:#F47067;">as</span><span style="color:#ADBAC7;"> Class</span><span style="color:#F47067;">&lt;</span><span style="color:#ADBAC7;">Any</span><span style="color:#F47067;">&gt;</span></span>
<span class="line"><span style="color:#768390;">// Suppose this is an instance of this Class.</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> myClassInstance: </span><span style="color:#F69D50;">Any</span></span>
<span class="line"><span style="color:#ADBAC7;">myClass.</span><span style="color:#DCBDFB;">resolve</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">firstMethod</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// ...</span></span>
<span class="line"><span style="color:#ADBAC7;">    }.</span><span style="color:#DCBDFB;">of</span><span style="color:#ADBAC7;">(myClassInstance).</span><span style="color:#DCBDFB;">invoke</span><span style="color:#ADBAC7;">(</span><span style="color:#F47067;">..</span><span style="color:#ADBAC7;">.)</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div>`,5),B=a(`<h3 id="vague-conditions" tabindex="-1"><a class="header-anchor" href="#vague-conditions" aria-hidden="true">#</a> Vague Conditions</h3><p>You will notice that there is a <code>release</code> method in <code>Test</code>, but its method parameters are very long and some types may not be directly obtainable.</p><p>At this point, you can use the <code>parameters(...)</code> condition with <code>VagueType</code> to fill in the method parameter types you don&#39;t want to specify.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#768390;">// Suppose this is an example of this Class.</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> test: </span><span style="color:#F69D50;">Test</span></span>
<span class="line"><span style="color:#768390;">// Call and execute with KavaRef.</span></span>
<span class="line"><span style="color:#ADBAC7;">Test::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">.</span><span style="color:#DCBDFB;">resolve</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">firstMethod</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"><span style="color:#ADBAC7;">        name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;release&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Use VagueType to fill in the types you don&#39;t want to fill in,</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// and ensure that other types can match.</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#DCBDFB;">parameters</span><span style="color:#ADBAC7;">(String::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">, VagueType, Boolean::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;">    } </span><span style="color:#768390;">// Get this method.</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><div class="custom-container warning"><p class="custom-container-title">Notice</p><p><code>VagueType</code> can only be used when there are filter conditions with multiple parameters, it cannot be used in filter conditions with only a single parameter, such as <code>type</code>.</p><p>You can create it using <code>VagueType</code>, <code>VagueType::class</code> or <code>VagueType::class.java</code>, all of which are correctly recognized as fuzzy filtering conditions.</p></div><h3 id="freedom-conditions" tabindex="-1"><a class="header-anchor" href="#freedom-conditions" aria-hidden="true">#</a> Freedom Conditions</h3><p>In <code>MemberCondition</code>, <code>name</code>, <code>type</code>, <code>parameterCount</code> and other conditions can all use the Kotlin lambda feature to create free filtering conditions.</p><p>Suppose we want to get the <code>doTask</code> method in <code>Test</code>, we can use the following implementation.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#768390;">// Suppose this is an example of this Class.</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> test: </span><span style="color:#F69D50;">Test</span></span>
<span class="line"><span style="color:#768390;">// Call and execute with KavaRef.</span></span>
<span class="line"><span style="color:#ADBAC7;">Test::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">.</span><span style="color:#DCBDFB;">resolve</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">firstMethod</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Use lambda to set the method name.</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#DCBDFB;">name</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"><span style="color:#ADBAC7;">            </span><span style="color:#768390;">// Set the name not case sensitive.</span></span>
<span class="line"><span style="color:#ADBAC7;">            it.</span><span style="color:#DCBDFB;">equals</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;dotask&quot;</span><span style="color:#ADBAC7;">, ignoreCase </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#6CB6FF;">true</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;">        }</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Set parameter type.</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#DCBDFB;">parameters</span><span style="color:#ADBAC7;">(String::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;">    }.</span><span style="color:#DCBDFB;">of</span><span style="color:#ADBAC7;">(test).</span><span style="color:#DCBDFB;">invoke</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;task_name&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h3 id="generic-conditions" tabindex="-1"><a class="header-anchor" href="#generic-conditions" aria-hidden="true">#</a> Generic Conditions</h3><p>KavaRef supports adding generic filtering conditions, which you can use the relevant functions provided by <code>TypeMatcher</code>.</p><p>Suppose we need to filter the <code>print</code> method in <code>Box&lt;String&gt;</code>.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#768390;">// Suppose this is an example of this Class.</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> box: </span><span style="color:#F69D50;">Box</span><span style="color:#ADBAC7;">&lt;</span><span style="color:#F69D50;">String</span><span style="color:#ADBAC7;">&gt;</span></span>
<span class="line"><span style="color:#768390;">// Call and execute with KavaRef.</span></span>
<span class="line"><span style="color:#ADBAC7;">box.</span><span style="color:#DCBDFB;">asResolver</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">firstMethod</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"><span style="color:#ADBAC7;">        name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;print&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Set generic parameter conditions.</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#DCBDFB;">genericParametes</span><span style="color:#ADBAC7;">(</span></span>
<span class="line"><span style="color:#ADBAC7;">            </span><span style="color:#768390;">// Filter generic name &quot;T&quot;.</span></span>
<span class="line"><span style="color:#ADBAC7;">            </span><span style="color:#DCBDFB;">typeVar</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;T&quot;</span><span style="color:#ADBAC7;">),</span></span>
<span class="line"><span style="color:#ADBAC7;">            </span><span style="color:#768390;">// Create TypeMatcher through Class.</span></span>
<span class="line"><span style="color:#ADBAC7;">            String::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">.</span><span style="color:#DCBDFB;">toTypeMatcher</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">        )</span></span>
<span class="line"><span style="color:#ADBAC7;">    }.</span><span style="color:#DCBDFB;">invoke</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;item&quot;</span><span style="color:#ADBAC7;">, </span><span style="color:#96D0FF;">&quot;str&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h3 id="filter-in-superclass" tabindex="-1"><a class="header-anchor" href="#filter-in-superclass" aria-hidden="true">#</a> Filter in Superclass</h3><p>You will notice that <code>Test</code> inherits from <code>BaseTest</code>, and now we want to get the <code>doBaseTask</code> method of <code>BaseTest</code>.</p><p>Without knowing the superclass name, we only need to add <code>superclass()</code> to the filter condition to achieve this function.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#768390;">// Suppose this is an example of this Class.</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> test: </span><span style="color:#F69D50;">Test</span></span>
<span class="line"><span style="color:#768390;">// Call and execute with KavaRef.</span></span>
<span class="line"><span style="color:#ADBAC7;">Test::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">.</span><span style="color:#DCBDFB;">resolve</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">firstMethod</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"><span style="color:#ADBAC7;">        name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;doBaseTask&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#DCBDFB;">parameters</span><span style="color:#ADBAC7;">(String::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Just add this condition.</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#DCBDFB;">superclass</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">    }.</span><span style="color:#DCBDFB;">of</span><span style="color:#ADBAC7;">(test).</span><span style="color:#DCBDFB;">invoke</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;task_name&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>At this time, we can get this method in the superclass.</p><div class="custom-container tip"><p class="custom-container-title">Tips</p><p><code>superclass()</code> once set it,it will automatically loop backwards whether there is this method in all inherited superclasses until the target has no superclass (the inheritance relationship is <code>java.lang.Object</code>).</p></div><div class="custom-container danger"><p class="custom-container-title">Pay Attention</p><p>The current filtering method can only filter to the current <code>Class</code> method unless the <code>superclass()</code> condition is specified, which is the default behavior of the Java reflection API. KavaRef will call <code>Class.getDeclaredMethods()</code> to get the current <code>Class</code> method instead of <code>Class.getMethods()</code>.</p></div><h3 id="other-conditions" tabindex="-1"><a class="header-anchor" href="#other-conditions" aria-hidden="true">#</a> Other Conditions</h3><p>KavaRef provides some filtering conditions to assist in the use of the Java reflection API.</p><p>Suppose we want to get the contents of the static variable <code>TAG</code> in <code>Test</code>.</p><p>In order to reflect that the filtering conditions include static descriptors, we can implement them using the following methods.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> tag </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> Test::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">.</span><span style="color:#DCBDFB;">resolve</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">firstField</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"><span style="color:#ADBAC7;">        name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;TAG&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;">        type </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> String::</span><span style="color:#DCBDFB;">class</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Create descriptor filtering.</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#DCBDFB;">modifiers</span><span style="color:#ADBAC7;">(Modifiers.STATIC)</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Or.</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#DCBDFB;">modifiers</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"><span style="color:#ADBAC7;">            it.</span><span style="color:#DCBDFB;">contains</span><span style="color:#ADBAC7;">(Modifiers.STATIC)</span></span>
<span class="line"><span style="color:#ADBAC7;">        }</span></span>
<span class="line"><span style="color:#ADBAC7;">    }.</span><span style="color:#DCBDFB;">get</span><span style="color:#ADBAC7;">&lt;</span><span style="color:#F69D50;">String</span><span style="color:#ADBAC7;">&gt;() </span><span style="color:#768390;">// Get field content.</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>You can also use string types to pass in full class names in conditions such as <code>type</code>, <code>parameters</code>, etc.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#768390;">// Suppose this is an example of this Class.</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> test: </span><span style="color:#F69D50;">Test</span></span>
<span class="line"><span style="color:#768390;">// Call and execute with KavaRef.</span></span>
<span class="line"><span style="color:#ADBAC7;">Test::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">.</span><span style="color:#DCBDFB;">resolve</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">firstMethod</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"><span style="color:#ADBAC7;">        name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;doTask&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Pass the full class name using string type.</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#DCBDFB;">parameters</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;java.lang.String&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;">    }.</span><span style="color:#DCBDFB;">of</span><span style="color:#ADBAC7;">(test).</span><span style="color:#DCBDFB;">invoke</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;task_name&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h3 id="exception-handling" tabindex="-1"><a class="header-anchor" href="#exception-handling" aria-hidden="true">#</a> Exception Handling</h3><p>By default, KavaRef throws an exception when a member is not found during a reflection call.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#ADBAC7;">Test::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">.</span><span style="color:#DCBDFB;">resolve</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">method</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"><span style="color:#ADBAC7;">        name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;doNonExistentMethod&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;">    } </span><span style="color:#768390;">// NoSuchMethodException will be thrown here.</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>If you do not want an exception to be thrown, you can set the optional condition <code>optional()</code>.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#ADBAC7;">Test::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">.</span><span style="color:#DCBDFB;">resolve</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// Set optional conditions.</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">optional</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">method</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"><span style="color:#ADBAC7;">        name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;doNonExistentMethod&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span></span>
<span class="line"><span style="color:#ADBAC7;">    } </span><span style="color:#768390;">// Return empty List&lt;MethodResolver&gt;.</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>KavaRef prints the complete exception content for debugging, and when using <code>optional()</code>, the exception is printed as a WARN level log.</p><blockquote><p>The following example</p></blockquote><div class="language-text" data-ext="text"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#adbac7;">No method found matching the condition for current class.</span></span>
<span class="line"><span style="color:#adbac7;">+------------------------------------------------+</span></span>
<span class="line"><span style="color:#adbac7;">| class com.demo                                 |</span></span>
<span class="line"><span style="color:#adbac7;">+------------+-----------------------------------+</span></span>
<span class="line"><span style="color:#adbac7;">| name       | doNonExistentMethod               |</span></span>
<span class="line"><span style="color:#adbac7;">| parameters | [class java.lang.String, boolean] |</span></span>
<span class="line"><span style="color:#adbac7;">+------------+-----------------------------------+</span></span>
<span class="line"><span style="color:#adbac7;"></span></span></code></pre></div><p>If you don&#39;t want KavaRef to throw or print anything, you can use <code>optional(silent = true)</code> to silently handle it, but we <strong>do not recommend this</strong>, which will mask the problem unless it is necessary.</p><div class="custom-container danger"><p class="custom-container-title">Pay Attention</p><p>If you set <code>optional()</code>, please do not use <code>firstMethod</code>, <code>firstConstructor</code> and other methods to get a single result. Because they throw an exception with empty list when there is no result, you can use the method with the suffix <code>OrNull</code> to get a single result.</p><p>But one thing you need to pay attention to here is that if you do not set <code>optional()</code>, then methods such as <code>firstMethodOrNull</code> will still throw exceptions when there is no result**, which is the expected behavior because <code>method { ... }</code> This is the &quot;build&quot; operation of the filter. Exceptions are handled here. Methods such as <code>firstMethodOrNull</code> are just an encapsulation. It is an exception handling of Kotlin&#39;s own standard library whether the result <code>List</code> is empty. It does not participate in exception handling of KavaRef filters.</p><p>So you must do it like the following.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#ADBAC7;">Test::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">.</span><span style="color:#DCBDFB;">resolve</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// Set optional conditions.</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">optional</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">firstMethodOrNull</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"><span style="color:#ADBAC7;">        name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;doNonExistentMethod&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;">    } </span><span style="color:#768390;">// Return MethodResolver or null.</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div></div><h3 id="log-management" tabindex="-1"><a class="header-anchor" href="#log-management" aria-hidden="true">#</a> Log Management</h3><p>KavaRef provides its own log management function, you can set the log level through <code>KavaRef.logLevel</code>.</p><p>You can set <code>KavaRef.logLevel = KavaRefRuntime.LogLevel.DEBUG</code> to enable DEBUG level logs so that KavaRef prints more detailed step-by-step filtering condition logs to the console during the filtering process.</p><p>If you want to turn off all log printing of KavaRef, you can set <code>KavaRef.logLevel = KavaRefRuntime.LogLevel.OFF</code>.</p><div class="custom-container tip"><p class="custom-container-title">Tips</p><p>On the JVM platform, KavaRef uses SLF4J as the implementation of log printing, and you can control log printing by configuring the implementation of SLF4J.</p><p>By default, you only need to introduce <code>org.slf4j:slf4j-simple</code> as a dependency to complete the log provider implementation, and in projects such as SpringBoot, you do not need additional configuration.</p><p>On the Android platform, KavaRef uses <code>android.util.Log</code> as an implementation of log printing, and you don&#39;t need additional configuration.</p></div><p>If you have more advanced requirements, you can implement <code>KavaRefRuntime.Logger</code> to customize your own log printing method.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#F47067;">class</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">MyLogger</span><span style="color:#ADBAC7;"> : </span><span style="color:#F69D50;">KavaRefRuntime</span><span style="color:#ADBAC7;">.</span><span style="color:#DCBDFB;">Logger</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// Here you can specify the tag for log printing.</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F47067;">override</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> tag </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;MyLogger&quot;</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F47067;">override</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">fun</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">debug</span><span style="color:#ADBAC7;">(msg: </span><span style="color:#F69D50;">Any</span><span style="color:#ADBAC7;">?, throwable: </span><span style="color:#F69D50;">Throwable</span><span style="color:#ADBAC7;">?) {</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Implement your log printing logic here.</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F47067;">override</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">fun</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">info</span><span style="color:#ADBAC7;">(msg: </span><span style="color:#F69D50;">Any</span><span style="color:#ADBAC7;">?, throwable: </span><span style="color:#F69D50;">Throwable</span><span style="color:#ADBAC7;">?) {</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Implement your log printing logic here.</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F47067;">override</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">fun</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">warn</span><span style="color:#ADBAC7;">(msg: </span><span style="color:#F69D50;">Any</span><span style="color:#ADBAC7;">?, throwable: </span><span style="color:#F69D50;">Throwable</span><span style="color:#ADBAC7;">?) {</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Implement your log printing logic here.</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F47067;">override</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">fun</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">error</span><span style="color:#ADBAC7;">(msg: </span><span style="color:#F69D50;">Any</span><span style="color:#ADBAC7;">?, throwable: </span><span style="color:#F69D50;">Throwable</span><span style="color:#ADBAC7;">?) {</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Implement your log printing logic here.</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"><span style="color:#ADBAC7;">}</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>Then, set it to KavaRef.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#ADBAC7;">KavaRef.</span><span style="color:#DCBDFB;">setLogger</span><span style="color:#ADBAC7;">(</span><span style="color:#DCBDFB;">MyLogger</span><span style="color:#ADBAC7;">())</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><h3 id="advanced-usage" tabindex="-1"><a class="header-anchor" href="#advanced-usage" aria-hidden="true">#</a> Advanced Usage</h3><p>The above content explains all the usage methods in standard scenarios. If you have a more fine-grained usage scenario, you can manually create related components of KavaRef.</p><p>If you don&#39;t like the Kotlin lambda writing, you can create chained calls manually.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#768390;">// Suppose this is an example of this Class.</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> test: </span><span style="color:#F69D50;">Test</span></span>
<span class="line"><span style="color:#768390;">// Call and execute with KavaRef.</span></span>
<span class="line"><span style="color:#ADBAC7;">Test::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">.</span><span style="color:#DCBDFB;">resolve</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">method</span><span style="color:#ADBAC7;">() </span><span style="color:#768390;">// Conditions begin.</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">name</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;doTask&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">parameters</span><span style="color:#ADBAC7;">(String::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">build</span><span style="color:#ADBAC7;">() </span><span style="color:#768390;">// Conditions ends (executes)</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">first</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">of</span><span style="color:#ADBAC7;">(test) </span><span style="color:#768390;">// Setting up instance.</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">invoke</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;task_name&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>You can also manually create any filtering conditions to achieve multiplexing it in any reflection.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#768390;">// Suppose this is an example of this Class.</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> test: </span><span style="color:#F69D50;">Test</span></span>
<span class="line"><span style="color:#768390;">// Create MethodCondition manually.</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> condition </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">MethodCondition</span><span style="color:#ADBAC7;">&lt;</span><span style="color:#F69D50;">Test</span><span style="color:#ADBAC7;">&gt;()</span></span>
<span class="line"><span style="color:#ADBAC7;">condition.name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;doTask&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;">condition.</span><span style="color:#DCBDFB;">parameters</span><span style="color:#ADBAC7;">(String::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#768390;">// Apply condition to reflection object.</span></span>
<span class="line"><span style="color:#ADBAC7;">Test::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">.</span><span style="color:#DCBDFB;">resolve</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">firstMethod</span><span style="color:#ADBAC7;">(condition)</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">of</span><span style="color:#ADBAC7;">(test) </span><span style="color:#768390;">// Setting up instance.</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">invoke</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;task_name&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>Alternatively, you can also manually and completely implement the entire reflection process.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#768390;">// Suppose this is an example of this Class.</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> test: </span><span style="color:#F69D50;">Test</span></span>
<span class="line"><span style="color:#768390;">// Create MethodCondition manually.</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> condition </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">MethodCondition</span><span style="color:#ADBAC7;">&lt;</span><span style="color:#F69D50;">Test</span><span style="color:#ADBAC7;">&gt;()</span></span>
<span class="line"><span style="color:#ADBAC7;">condition.name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;doTask&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;">condition.</span><span style="color:#DCBDFB;">parameters</span><span style="color:#ADBAC7;">(String::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#768390;">// Create MemberCondition.Configuration manually.</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> configuration </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> Test::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">.java.</span><span style="color:#DCBDFB;">createConfiguration</span><span style="color:#ADBAC7;">(</span></span>
<span class="line"><span style="color:#ADBAC7;">    memberInstance </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> test, </span><span style="color:#768390;">// Setting up instance.</span></span>
<span class="line"><span style="color:#ADBAC7;">    processorResolver </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#6CB6FF;">null</span><span style="color:#ADBAC7;">, </span><span style="color:#768390;">// Use the default resolver, refer to the &quot;Custom Resolver&quot; below.</span></span>
<span class="line"><span style="color:#ADBAC7;">    superclass </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#6CB6FF;">false</span><span style="color:#ADBAC7;">, </span><span style="color:#768390;">// Whether to filter in superclass.</span></span>
<span class="line"><span style="color:#ADBAC7;">    optional </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> MemberCondition.Configuration.Optional.NO </span><span style="color:#768390;">// Configure optional conditions.</span></span>
<span class="line"><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#768390;">// Create and start filtering.</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> resolvers </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> condition.</span><span style="color:#DCBDFB;">build</span><span style="color:#ADBAC7;">(configuration)</span></span>
<span class="line"><span style="color:#768390;">// Get the first result.</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> resolver </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> resolvers.</span><span style="color:#DCBDFB;">first</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#768390;">// Execute the method.</span></span>
<span class="line"><span style="color:#ADBAC7;">resolver.</span><span style="color:#DCBDFB;">invoke</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;task_name&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>If you have more advanced requirements for business layer logic, you can also use <code>mergeWith</code> to merge multiple filter conditions.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#768390;">// Suppose this is an instance of this Class.</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> test: </span><span style="color:#F69D50;">Test</span></span>
<span class="line"><span style="color:#768390;">// Create MethodCondition manually.</span></span>
<span class="line"><span style="color:#768390;">// Create the first condition.</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> condition1 </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">MethodCondition</span><span style="color:#ADBAC7;">&lt;</span><span style="color:#F69D50;">Test</span><span style="color:#ADBAC7;">&gt;()</span></span>
<span class="line"><span style="color:#ADBAC7;">condition1.name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;doTask&quot;</span></span>
<span class="line"><span style="color:#768390;">// Create a second condition.</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> condition2 </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">MethodCondition</span><span style="color:#ADBAC7;">&lt;</span><span style="color:#F69D50;">Test</span><span style="color:#ADBAC7;">&gt;()</span></span>
<span class="line"><span style="color:#ADBAC7;">condition2.</span><span style="color:#DCBDFB;">parameters</span><span style="color:#ADBAC7;">(String::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#768390;">// Merge condition2 into condition1.</span></span>
<span class="line"><span style="color:#768390;">// At this time, the condition of condition1 will contain the condition that condition2 is not null.</span></span>
<span class="line"><span style="color:#768390;">// The duplicated conditions in condition1 will be overwritten by the condition2 condition.</span></span>
<span class="line"><span style="color:#ADBAC7;">condition1.</span><span style="color:#DCBDFB;">mergeWith</span><span style="color:#ADBAC7;">(condition2)</span></span>
<span class="line"><span style="color:#768390;">// You can also use the infix syntax.</span></span>
<span class="line"><span style="color:#ADBAC7;">condition1 mergeWith condition2</span></span>
<span class="line"><span style="color:#768390;">// Call and execute with KavaRef.</span></span>
<span class="line"><span style="color:#ADBAC7;">Test::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">.</span><span style="color:#DCBDFB;">resolve</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">firstMethod</span><span style="color:#ADBAC7;">(condition1)</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">of</span><span style="color:#ADBAC7;">(test)</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">invoke</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;task_name&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><div class="custom-container danger"><p class="custom-container-title">Pay Attention</p><p>Reused use of <code>build(...)</code> will no longer be allowed for creation when <code>MemberCondition.Configuration</code> is set. At this point you need to use <code>copy()</code> to copy and create a new <code>MemberCondition</code>.</p><p>Similarly, <code>InstanceAwareResolver</code> is not allowed to duplicately set up new instances after setting the instance via <code>MemberCondition.Configuration.memberInstance</code> or <code>of(instance)</code>. At this time, you also need to use <code>copy()</code> to copy and create a new <code>InstanceAwareResolver</code>.</p></div><h3 id="custom-resolver" tabindex="-1"><a class="header-anchor" href="#custom-resolver" aria-hidden="true">#</a> Custom Resolver</h3><p>KavaRef uses the default <code>Member</code> resolver for filtering. If you want to implement your own resolver, you can customize the global and the resolver used for each reflection process.</p><p>You can inherit from <code>MemberProccessor.Resolver</code> to implement your own resolver.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#F47067;">class</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">MyMemberProcessorResolver</span><span style="color:#ADBAC7;"> : </span><span style="color:#F69D50;">MemberProcessor</span><span style="color:#ADBAC7;">.</span><span style="color:#DCBDFB;">Resolver</span><span style="color:#ADBAC7;">() {</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F47067;">override</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">fun</span><span style="color:#ADBAC7;"> &lt;</span><span style="color:#F69D50;">T</span><span style="color:#ADBAC7;"> : </span><span style="color:#F69D50;">Any</span><span style="color:#ADBAC7;">&gt; </span><span style="color:#DCBDFB;">getDeclaredConstructors</span><span style="color:#ADBAC7;">(declaringClass: </span><span style="color:#F69D50;">Class</span><span style="color:#ADBAC7;">&lt;</span><span style="color:#F69D50;">T</span><span style="color:#ADBAC7;">&gt;): </span><span style="color:#F69D50;">List</span><span style="color:#ADBAC7;">&lt;</span><span style="color:#F69D50;">Constructor</span><span style="color:#ADBAC7;">&lt;</span><span style="color:#F69D50;">T</span><span style="color:#ADBAC7;">&gt;&gt; {</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Intercept and implement your constructor filtering logic here.</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#F47067;">return</span><span style="color:#ADBAC7;"> </span><span style="color:#6CB6FF;">super</span><span style="color:#ADBAC7;">.</span><span style="color:#DCBDFB;">getDeclaredConstructors</span><span style="color:#ADBAC7;">(declaringClass)</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F47067;">override</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">fun</span><span style="color:#ADBAC7;"> &lt;</span><span style="color:#F69D50;">T</span><span style="color:#ADBAC7;"> : </span><span style="color:#F69D50;">Any</span><span style="color:#ADBAC7;">&gt; </span><span style="color:#DCBDFB;">getDeclaredMethods</span><span style="color:#ADBAC7;">(declaringClass: </span><span style="color:#F69D50;">Class</span><span style="color:#ADBAC7;">&lt;</span><span style="color:#F69D50;">T</span><span style="color:#ADBAC7;">&gt;): </span><span style="color:#F69D50;">List</span><span style="color:#ADBAC7;">&lt;</span><span style="color:#F69D50;">Method</span><span style="color:#ADBAC7;">&gt; {</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Intercept and implement your method filtering logic here.</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#F47067;">return</span><span style="color:#ADBAC7;"> </span><span style="color:#6CB6FF;">super</span><span style="color:#ADBAC7;">.</span><span style="color:#DCBDFB;">getDeclaredMethods</span><span style="color:#ADBAC7;">(declaringClass)</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F47067;">override</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">fun</span><span style="color:#ADBAC7;"> &lt;</span><span style="color:#F69D50;">T</span><span style="color:#ADBAC7;"> : </span><span style="color:#F69D50;">Any</span><span style="color:#ADBAC7;">&gt; </span><span style="color:#DCBDFB;">getDeclaredFields</span><span style="color:#ADBAC7;">(declaringClass: </span><span style="color:#F69D50;">Class</span><span style="color:#ADBAC7;">&lt;</span><span style="color:#F69D50;">T</span><span style="color:#ADBAC7;">&gt;): </span><span style="color:#F69D50;">List</span><span style="color:#ADBAC7;">&lt;</span><span style="color:#F69D50;">Field</span><span style="color:#ADBAC7;">&gt; {</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Intercept and implement your field filtering logic here.</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#F47067;">return</span><span style="color:#ADBAC7;"> </span><span style="color:#6CB6FF;">super</span><span style="color:#ADBAC7;">.</span><span style="color:#DCBDFB;">getDeclaredFields</span><span style="color:#ADBAC7;">(declaringClass)</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"><span style="color:#ADBAC7;">}</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>You can then set it to the global configuration.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#ADBAC7;">MemberProcessor.globalResolver </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">MyMemberProcessorResolver</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>Alternatively, during each reflection, you can set up a custom resolver using <code>MemberCondition.Configuration</code> or use a chain call to set up a resolver.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#768390;">// Create resolver.</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> myResolver </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">MyMemberProcessorResolver</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#768390;">// Suppose this is an instance of this Class.</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> test: </span><span style="color:#F69D50;">Test</span></span>
<span class="line"><span style="color:#768390;">// Call and execute using KavaRef.</span></span>
<span class="line"><span style="color:#ADBAC7;">Test::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">.</span><span style="color:#DCBDFB;">resolve</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#768390;">// Set custom resolver.</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">processor</span><span style="color:#ADBAC7;">(myResolver)</span></span>
<span class="line"><span style="color:#ADBAC7;">    .</span><span style="color:#DCBDFB;">firstMethod</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"><span style="color:#ADBAC7;">        name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;doTask&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#DCBDFB;">parameters</span><span style="color:#ADBAC7;">(String::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;">    }.</span><span style="color:#DCBDFB;">of</span><span style="color:#ADBAC7;">(test).</span><span style="color:#DCBDFB;">invoke</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;task_name&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div>`,82),C={class:"custom-container tip"},m=n("p",{class:"custom-container-title"},"Tips",-1),h=a(`<h3 id="about-cache" tabindex="-1"><a class="header-anchor" href="#about-cache" aria-hidden="true">#</a> About Cache</h3><p>Due to the diversity of filtering conditions, KavaRef does not directly provide caching function, and the implementation method of caching will also vary depending on the implementation method of each developer.</p><p>We recommend manually implementing caches of <code>MemberResolver</code> created with filter results for improved performance and refer to <a href="#create-manually">Create Manually</a> to split filter conditions to optimize code reuse.</p><div class="custom-container danger"><p class="custom-container-title">Pay Attention</p><p>If you use <code>val myResolver by lazy { ... }</code> to implement the cache, for example, do so below.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> myResolver </span><span style="color:#F47067;">by</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">lazy</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"><span style="color:#ADBAC7;">    Test::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">.</span><span style="color:#DCBDFB;">resolve</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">        .</span><span style="color:#DCBDFB;">firstMethod</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"><span style="color:#ADBAC7;">            name </span><span style="color:#F47067;">=</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&quot;doTask&quot;</span></span>
<span class="line"><span style="color:#ADBAC7;">            </span><span style="color:#DCBDFB;">parameters</span><span style="color:#ADBAC7;">(String::</span><span style="color:#DCBDFB;">class</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;">        }</span></span>
<span class="line"><span style="color:#ADBAC7;">}</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>You may do this when calling.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#768390;">// Suppose this is an instance of this Class.</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> test: </span><span style="color:#F69D50;">Test</span></span>
<span class="line"><span style="color:#768390;">// Call and execute using KavaRef.</span></span>
<span class="line"><span style="color:#ADBAC7;">myResolver.</span><span style="color:#DCBDFB;">of</span><span style="color:#ADBAC7;">(test).</span><span style="color:#DCBDFB;">invoke</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;task_name&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>Please note that since <code>MemberResolver</code> is cached, the same instance is called every time you reference it, and the instance object of <code>MemberResolver</code> is not allowed to be set duplicately (see the &quot;Pay Attention&quot; below <a href="#create-manually">Create Manually</a>).</p><p>So calling this directly will throw an exception, you need to change it to the following form.</p><blockquote><p>The following example</p></blockquote><div class="language-kotlin line-numbers-mode" data-ext="kt"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#768390;">// Suppose this is an instance of this Class.</span></span>
<span class="line"><span style="color:#F47067;">val</span><span style="color:#ADBAC7;"> test: </span><span style="color:#F69D50;">Test</span></span>
<span class="line"><span style="color:#768390;">// Call and execute using KavaRef.</span></span>
<span class="line"><span style="color:#ADBAC7;">myResolver.</span><span style="color:#DCBDFB;">copy</span><span style="color:#ADBAC7;">().</span><span style="color:#DCBDFB;">of</span><span style="color:#ADBAC7;">(test).</span><span style="color:#DCBDFB;">invoke</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;task_name&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>This allows you to copy a new <code>MemberResolver</code> instance every time you call without repeating the reflection process and throwing an exception.</p></div><h3 id="java-usage" tabindex="-1"><a class="header-anchor" href="#java-usage" aria-hidden="true">#</a> Java Usage</h3><p>KavaRef is not recommended to be used directly in Java because its API design is based on Kotlin&#39;s features and syntax sugar.</p><p>If you need to use KavaRef in Java, you can do it in the following ways.</p><blockquote><p>The following example</p></blockquote><div class="language-java line-numbers-mode" data-ext="java"><pre class="shiki github-dark-dimmed" style="background-color:#22272e;" tabindex="0"><code><span class="line"><span style="color:#F47067;">public</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">class</span><span style="color:#ADBAC7;"> </span><span style="color:#F69D50;">Main</span><span style="color:#ADBAC7;"> {</span></span>
<span class="line"></span>
<span class="line"><span style="color:#ADBAC7;">    </span><span style="color:#F47067;">public</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">static</span><span style="color:#ADBAC7;"> </span><span style="color:#F47067;">void</span><span style="color:#ADBAC7;"> </span><span style="color:#DCBDFB;">main</span><span style="color:#ADBAC7;">(</span><span style="color:#F47067;">String</span><span style="color:#ADBAC7;">[] </span><span style="color:#F69D50;">args</span><span style="color:#ADBAC7;">) {</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Suppose this is an example of this Class.</span></span>
<span class="line"><span style="color:#ADBAC7;">        Test</span><span style="color:#F69D50;"> </span><span style="color:#ADBAC7;">test;</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Call and execute with KavaRef.</span></span>
<span class="line"><span style="color:#ADBAC7;">        KavaRef.</span><span style="color:#DCBDFB;">resolveClass</span><span style="color:#ADBAC7;">(Test.class)</span></span>
<span class="line"><span style="color:#ADBAC7;">            .</span><span style="color:#DCBDFB;">method</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">            .</span><span style="color:#DCBDFB;">name</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;doTask&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;">            .</span><span style="color:#DCBDFB;">parameters</span><span style="color:#ADBAC7;">(String.class)</span></span>
<span class="line"><span style="color:#ADBAC7;">            .</span><span style="color:#DCBDFB;">build</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">            .</span><span style="color:#DCBDFB;">get</span><span style="color:#ADBAC7;">(</span><span style="color:#6CB6FF;">0</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;">            .</span><span style="color:#DCBDFB;">of</span><span style="color:#ADBAC7;">(test)</span></span>
<span class="line"><span style="color:#ADBAC7;">            .</span><span style="color:#DCBDFB;">invoke</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;task_name&quot;</span><span style="color:#ADBAC7;">);</span></span>
<span class="line"><span style="color:#ADBAC7;">        </span><span style="color:#768390;">// Or create KavaRef reflections using an instance.</span></span>
<span class="line"><span style="color:#ADBAC7;">        KavaRef.</span><span style="color:#DCBDFB;">resolveObject</span><span style="color:#ADBAC7;">(test)</span></span>
<span class="line"><span style="color:#ADBAC7;">            .</span><span style="color:#DCBDFB;">method</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">            .</span><span style="color:#DCBDFB;">name</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;doTask&quot;</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;">            .</span><span style="color:#DCBDFB;">parameters</span><span style="color:#ADBAC7;">(String.class)</span></span>
<span class="line"><span style="color:#ADBAC7;">            .</span><span style="color:#DCBDFB;">build</span><span style="color:#ADBAC7;">()</span></span>
<span class="line"><span style="color:#ADBAC7;">            .</span><span style="color:#DCBDFB;">get</span><span style="color:#ADBAC7;">(</span><span style="color:#6CB6FF;">0</span><span style="color:#ADBAC7;">)</span></span>
<span class="line"><span style="color:#ADBAC7;">            .</span><span style="color:#DCBDFB;">invoke</span><span style="color:#ADBAC7;">(</span><span style="color:#96D0FF;">&quot;task_name&quot;</span><span style="color:#ADBAC7;">);</span></span>
<span class="line"><span style="color:#ADBAC7;">    }</span></span>
<span class="line"><span style="color:#ADBAC7;">}</span></span>
<span class="line"></span></code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div>`,9);function b(g,F){const t=p("ExternalLinkIcon"),l=p("RouterLink");return i(),r("div",null,[y,n("p",null,[s("You can view the KDoc "),n("a",A,[s("click here"),e(t)]),s(".")]),u,n("div",D,[v,n("p",null,[s("You can also use "),e(l,{to:"/en/library/kavaref-extension.html#create-class-object"},{default:o(()=>[s("Create Class Object")]),_:1}),s(" provided in "),e(l,{to:"/en/library/kavaref-extension.html"},{default:o(()=>[s("kavaref-extension")]),_:1}),s(" to solve this problem.")])]),B,n("div",C,[m,n("p",null,[s("You can find some publicly maintained custom solvers in "),e(l,{to:"/en/config/processor-resolvers.html"},{default:o(()=>[s("here")]),_:1}),s(" and define them in your project to use.")])]),h])}const k=c(d,[["render",b],["__file","kavaref-core.html.vue"]]);export{k as default};
