Package io.papermc.asm.rules.method
Record Class MethodRewriteRule.RewriteSingle
java.lang.Object
java.lang.Record
io.papermc.asm.rules.method.MethodRewriteRule.RewriteSingle
- Record Components:
opcode- the replaced opcodeowner- the replaced ownername- the replaced namedescriptor- the replaced descriptorisInterface- if the replaced method is an interface methodisInvokeDynamic- if the replaced method is an invokedynamicgeneratorInfo- info for generating the method (optional)
- All Implemented Interfaces:
MethodRewriteRule.Rewrite<GeneratedMethodHolder.MethodCallData>
- Enclosing interface:
- MethodRewriteRule
public static record MethodRewriteRule.RewriteSingle(int opcode, ClassDesc owner, String name, MethodTypeDesc descriptor, boolean isInterface, boolean isInvokeDynamic, @Nullable MethodRewriteRule.GeneratorInfo<GeneratedMethodHolder.MethodCallData> generatorInfo, @Nullable Consumer<Object[]> handleExtras)
extends Record
implements MethodRewriteRule.Rewrite<GeneratedMethodHolder.MethodCallData>
Holds the structure of the rewritten method that replaces a matching method found in the bytecode.
-
Field Summary
Fields inherited from interface io.papermc.asm.rules.method.MethodRewriteRule.Rewrite
BOOTSTRAP_HANDLE_IDX, DYNAMIC_TYPE_IDX -
Constructor Summary
ConstructorsConstructorDescriptionRewriteSingle(int opcode, ClassDesc owner, String name, MethodTypeDesc descriptor, boolean isInterface, boolean isInvokeDynamic) RewriteSingle(int opcode, ClassDesc owner, String name, MethodTypeDesc descriptor, boolean isInterface, boolean isInvokeDynamic, @Nullable MethodRewriteRule.GeneratorInfo<GeneratedMethodHolder.MethodCallData> generatorInfo, @Nullable Consumer<Object[]> handleExtras) Creates an instance of aRewriteSinglerecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(MethodVisitor delegate, MethodNode context) voidapplyToBootstrapArguments(Object[] arguments) Returns the value of thedescriptorrecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of thegeneratorInforecord component.Returns the value of thehandleExtrasrecord component.final inthashCode()Returns a hash code value for this object.booleanReturns the value of theisInterfacerecord component.booleanReturns the value of theisInvokeDynamicrecord component.name()Returns the value of thenamerecord component.intopcode()Returns the value of theopcoderecord component.owner()Returns the value of theownerrecord component.final StringtoString()Returns a string representation of this record class.withGeneratorInfo(GeneratedMethodHolder holder, GeneratedMethodHolder.MethodCallData original) withHandleExtras(Consumer<Object[]> extras) withNamePrefix(String prefix)
-
Constructor Details
-
RewriteSingle
public RewriteSingle(int opcode, ClassDesc owner, String name, MethodTypeDesc descriptor, boolean isInterface, boolean isInvokeDynamic) -
RewriteSingle
public RewriteSingle(int opcode, ClassDesc owner, String name, MethodTypeDesc descriptor, boolean isInterface, boolean isInvokeDynamic, @Nullable MethodRewriteRule.GeneratorInfo<GeneratedMethodHolder.MethodCallData> generatorInfo, @Nullable Consumer<Object[]> handleExtras) Creates an instance of aRewriteSinglerecord class.- Parameters:
opcode- the value for theopcoderecord componentowner- the value for theownerrecord componentname- the value for thenamerecord componentdescriptor- the value for thedescriptorrecord componentisInterface- the value for theisInterfacerecord componentisInvokeDynamic- the value for theisInvokeDynamicrecord componentgeneratorInfo- the value for thegeneratorInforecord componenthandleExtras- the value for thehandleExtrasrecord component
-
-
Method Details
-
apply
- Specified by:
applyin interfaceMethodRewriteRule.Rewrite<GeneratedMethodHolder.MethodCallData>
-
applyToBootstrapArguments
- Specified by:
applyToBootstrapArgumentsin interfaceMethodRewriteRule.Rewrite<GeneratedMethodHolder.MethodCallData>
-
withNamePrefix
public MethodRewriteRule.Rewrite<GeneratedMethodHolder.MethodCallData> withNamePrefix(String prefix) - Specified by:
withNamePrefixin interfaceMethodRewriteRule.Rewrite<GeneratedMethodHolder.MethodCallData>
-
withGeneratorInfo
public MethodRewriteRule.Rewrite<GeneratedMethodHolder.MethodCallData> withGeneratorInfo(GeneratedMethodHolder holder, GeneratedMethodHolder.MethodCallData original) - Specified by:
withGeneratorInfoin interfaceMethodRewriteRule.Rewrite<GeneratedMethodHolder.MethodCallData>
-
withHandleExtras
public MethodRewriteRule.Rewrite<GeneratedMethodHolder.MethodCallData> withHandleExtras(Consumer<Object[]> extras) - Specified by:
withHandleExtrasin interfaceMethodRewriteRule.Rewrite<GeneratedMethodHolder.MethodCallData>
-
createMethodGenerator
- Specified by:
createMethodGeneratorin interfaceMethodRewriteRule.Rewrite<GeneratedMethodHolder.MethodCallData>
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
opcode
public int opcode()Returns the value of theopcoderecord component.- Returns:
- the value of the
opcoderecord component
-
owner
Returns the value of theownerrecord component.- Returns:
- the value of the
ownerrecord component
-
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
descriptor
Returns the value of thedescriptorrecord component.- Returns:
- the value of the
descriptorrecord component
-
isInterface
public boolean isInterface()Returns the value of theisInterfacerecord component.- Returns:
- the value of the
isInterfacerecord component
-
isInvokeDynamic
public boolean isInvokeDynamic()Returns the value of theisInvokeDynamicrecord component.- Returns:
- the value of the
isInvokeDynamicrecord component
-
generatorInfo
public @Nullable MethodRewriteRule.GeneratorInfo<GeneratedMethodHolder.MethodCallData> generatorInfo()Returns the value of thegeneratorInforecord component.- Returns:
- the value of the
generatorInforecord component
-
handleExtras
Returns the value of thehandleExtrasrecord component.- Returns:
- the value of the
handleExtrasrecord component
-