tutorial:mixin_injects
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
tutorial:mixin_injects [2020/02/07 01:48] – draylar | tutorial:mixin_injects [2020/05/28 18:31] – b0undarybreaker | ||
---|---|---|---|
Line 19: | Line 19: | ||
| TAIL | Before the final return statement | | | TAIL | Before the final return statement | | ||
- | In the case of injection points that reference statements or members, the target value can be set inside //@At//. | + | In the case of injection points that reference statements or members, the target value can be set inside //@At//. Target value is specified using JVM bytecode descriptors. |
+ | |||
+ | Oracle defines the following [[https:// | ||
+ | |||
+ | ^ Descriptor ^ Primitive ^ Description ^ | ||
+ | | B | byte | signed byte | | ||
+ | | C | char | Unicode character code point in the Basic Multilingual Plane, encoded with UTF-16 | | ||
+ | | D | double | double-precision floating-point value | | ||
+ | | F | float | single-precision floating-point value | | ||
+ | | I | int | integer | | ||
+ | | J | long | long integer | | ||
+ | | L// | ||
+ | | S | short | signed short | | ||
+ | | Z | boolean | '' | ||
+ | | [ | reference | one array dimension | | ||
+ | |||
+ | A method descriptor is comprised of the method name, followed by a set of parentheses containing the input types, followed by the output type. A method defined in Java as '' | ||
//@Inject// methods always have a void return type. The method name does not matter; using something that describes what the inject does is best. The target method' | //@Inject// methods always have a void return type. The method name does not matter; using something that describes what the inject does is best. The target method' | ||
=== Returning & Cancelling from Inject === | === Returning & Cancelling from Inject === | ||
- | To cancel or return early inside a method, use '' | + | To cancel or return early inside a method, use '' |
<code java> | <code java> | ||
@Inject(method = " | @Inject(method = " | ||
Line 30: | Line 46: | ||
+ | === Injecting into Constructors === | ||
+ | To inject into a constructor, | ||
===== Practical Example ===== | ===== Practical Example ===== |
tutorial/mixin_injects.txt · Last modified: 2022/08/05 19:19 by clomclem