Package io.papermc.asm.rules.method
Record Class DirectStaticRewrite
java.lang.Object
java.lang.Record
io.papermc.asm.rules.method.DirectStaticRewrite
- Record Components:
owners- the owners to targetmethodMatcher- the method matcher to usestaticRedirectOwner- the owner to redirect to
- All Implemented Interfaces:
MethodRewriteRule,OwnableMethodRewriteRule,OwnableMethodRewriteRule.Filtered,StaticRewrite,OwnableRewriteRule,RewriteRule
public record DirectStaticRewrite(Set<ClassDesc> owners, @Nullable String staticMethodName, MethodMatcher methodMatcher, ClassDesc staticRedirectOwner)
extends Record
implements StaticRewrite, OwnableMethodRewriteRule.Filtered
Rewrites a method by just directly routing it to an identical static method in another class.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic @interfaceAnnotate apublicstaticmethod with this annotation and then scan it with TODO to automatically generate aDirectParameterRewriterule.Nested classes/interfaces inherited from interface io.papermc.asm.rules.method.OwnableMethodRewriteRule
OwnableMethodRewriteRule.FilteredNested classes/interfaces inherited from interface io.papermc.asm.rules.RewriteRule
RewriteRule.Chain, RewriteRule.ChainBuilder, RewriteRule.Delegate, RewriteRule.GeneratorAdapterFactory -
Field Summary
Fields inherited from interface io.papermc.asm.rules.method.MethodRewriteRule
LAMBDA_METAFACTORY_OWNERFields inherited from interface io.papermc.asm.rules.RewriteRule
EMPTYFields inherited from interface io.papermc.asm.rules.method.StaticRewrite
CONSTRUCTOR_METHOD_NAME -
Constructor Summary
ConstructorsConstructorDescriptionDirectStaticRewrite(Set<ClassDesc> owners, MethodMatcher methodMatcher, ClassDesc staticRedirectOwner) DirectStaticRewrite(Set<ClassDesc> owners, @Nullable String staticMethodName, MethodMatcher methodMatcher, ClassDesc staticRedirectOwner) Creates an instance of aDirectStaticRewriterecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic DirectStaticRewritecreate(Method method, DirectStaticRewrite.Wrapper annotation) createConstructorRewrite(ClassProcessingContext context, MethodTypeDesc intermediateDescriptor, GeneratedMethodHolder.ConstructorCallData originalCallData) Creates a rewrite for the given constructor call data.createRewrite(ClassProcessingContext context, MethodTypeDesc intermediateDescriptor, GeneratedMethodHolder.MethodCallData originalCallData) Creates a rewrite for the given method call data.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of themethodMatcherrecord component.owners()Returns the value of theownersrecord component.Returns the value of thestaticMethodNamerecord component.Returns the value of thestaticRedirectOwnerrecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface io.papermc.asm.rules.method.MethodRewriteRule
createVisitorMethods inherited from interface io.papermc.asm.rules.method.OwnableMethodRewriteRule.Filtered
shouldProcessMethods inherited from interface io.papermc.asm.rules.OwnableRewriteRule
matchesOwnerMethods inherited from interface io.papermc.asm.rules.method.StaticRewrite
rewrite, transformToRedirectDescriptor
-
Constructor Details
-
DirectStaticRewrite
public DirectStaticRewrite(Set<ClassDesc> owners, MethodMatcher methodMatcher, ClassDesc staticRedirectOwner) -
DirectStaticRewrite
public DirectStaticRewrite(Set<ClassDesc> owners, @Nullable String staticMethodName, MethodMatcher methodMatcher, ClassDesc staticRedirectOwner) Creates an instance of aDirectStaticRewriterecord class.- Parameters:
owners- the value for theownersrecord componentstaticMethodName- the value for thestaticMethodNamerecord componentmethodMatcher- the value for themethodMatcherrecord componentstaticRedirectOwner- the value for thestaticRedirectOwnerrecord component
-
-
Method Details
-
createRewrite
public MethodRewrite<GeneratedMethodHolder.MethodCallData> createRewrite(ClassProcessingContext context, MethodTypeDesc intermediateDescriptor, GeneratedMethodHolder.MethodCallData originalCallData) Description copied from interface:StaticRewriteCreates a rewrite for the given method call data.- Specified by:
createRewritein interfaceStaticRewrite- Parameters:
context- the contextintermediateDescriptor- the descriptor modified from the original to account for the method call type (interface, virtual, static, etc.)originalCallData- the original method call data- Returns:
- the rewrite
-
createConstructorRewrite
public MethodRewrite<GeneratedMethodHolder.ConstructorCallData> createConstructorRewrite(ClassProcessingContext context, MethodTypeDesc intermediateDescriptor, GeneratedMethodHolder.ConstructorCallData originalCallData) Description copied from interface:StaticRewriteCreates a rewrite for the given constructor call data.- Specified by:
createConstructorRewritein interfaceStaticRewrite- Parameters:
context- the contextintermediateDescriptor- the descriptor modified from the original to include a return typeoriginalCallData- the original constructor call data- Returns:
- the rewrite
-
staticRedirectOwner
- Specified by:
staticRedirectOwnerin interfaceStaticRewrite
-
create
@Internal public static DirectStaticRewrite create(Method method, DirectStaticRewrite.Wrapper annotation) -
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. All components in this record class are compared withObjects::equals(Object,Object). -
owners
Returns the value of theownersrecord component.- Specified by:
ownersin interfaceOwnableRewriteRule- Returns:
- the value of the
ownersrecord component
-
staticMethodName
Returns the value of thestaticMethodNamerecord component.- Returns:
- the value of the
staticMethodNamerecord component
-
methodMatcher
Returns the value of themethodMatcherrecord component.- Specified by:
methodMatcherin interfaceOwnableMethodRewriteRule.Filtered- Returns:
- the value of the
methodMatcherrecord component
-
staticRedirectOwner
Returns the value of thestaticRedirectOwnerrecord component.- Returns:
- the value of the
staticRedirectOwnerrecord component
-