zh_cn:tutorial:mixin_examples
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
zh_cn:tutorial:mixin_examples [2023/01/29 13:51] – 补充一些内容 hendrix-shen | zh_cn:tutorial:mixin_examples [2023/12/18 02:10] – [使用偏移注入到一个方法调用之前] solidblock | ||
---|---|---|---|
Line 12: | Line 12: | ||
===== 在 Mixin 类中获取目标类实例对象 ===== | ===== 在 Mixin 类中获取目标类实例对象 ===== | ||
+ | 注意:应该避免像这样两次强转 '' | ||
Mixin: | Mixin: | ||
<code java> | <code java> | ||
Line 18: | Line 19: | ||
@Inject(method = " | @Inject(method = " | ||
private void injected(CallbackInfo ci) { | private void injected(CallbackInfo ci) { | ||
- | | + | |
} | } | ||
} | } | ||
</ | </ | ||
- | |||
===== 注入到静态初始化代码块的开头 ===== | ===== 注入到静态初始化代码块的开头 ===== | ||
Mixin: | Mixin: | ||
Line 143: | Line 143: | ||
</ | </ | ||
- | ===== 使用偏移注入到一个方法调用之前 | + | ===== 使用偏移量注入 ===== |
Mixin: | Mixin: | ||
<code java> | <code java> |
zh_cn/tutorial/mixin_examples.txt · Last modified: 2023/12/18 02:19 by solidblock