Package net.bytebuddy.implementation
Class Implementation.SpecialMethodInvocation.Simple
- java.lang.Object
-
- net.bytebuddy.implementation.Implementation.SpecialMethodInvocation.AbstractBase
-
- net.bytebuddy.implementation.Implementation.SpecialMethodInvocation.Simple
-
- All Implemented Interfaces:
StackManipulation
,Implementation.SpecialMethodInvocation
- Enclosing interface:
- Implementation.SpecialMethodInvocation
public static class Implementation.SpecialMethodInvocation.Simple extends Implementation.SpecialMethodInvocation.AbstractBase
A canonical implementation of aImplementation.SpecialMethodInvocation
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.Implementation.SpecialMethodInvocation
Implementation.SpecialMethodInvocation.AbstractBase, Implementation.SpecialMethodInvocation.Illegal, Implementation.SpecialMethodInvocation.Simple
-
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.bytecode.StackManipulation
StackManipulation.Compound, StackManipulation.Size, StackManipulation.Trivial
-
-
Field Summary
Fields Modifier and Type Field Description private MethodDescription
methodDescription
The method description that is represented by this legal special method invocation.private StackManipulation
stackManipulation
A stack manipulation representing the method's invocation on the type description.private TypeDescription
typeDescription
The type description that is represented by this legal special method invocation.
-
Constructor Summary
Constructors Modifier Constructor Description protected
Simple(MethodDescription methodDescription, TypeDescription typeDescription, StackManipulation stackManipulation)
Creates a new legal special method invocation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StackManipulation.Size
apply(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext)
Applies the stack manipulation that is described by this instance.MethodDescription
getMethodDescription()
Returns the method that represents this special method invocation.TypeDescription
getTypeDescription()
Returns the target type the represented method is invoked on.static Implementation.SpecialMethodInvocation
of(MethodDescription methodDescription, TypeDescription typeDescription)
Creates a special method invocation for a given invocation target.Implementation.SpecialMethodInvocation
withCheckedCompatibilityTo(MethodDescription.TypeToken token)
Checks that this special method invocation is compatible with the supplied type representation.-
Methods inherited from class net.bytebuddy.implementation.Implementation.SpecialMethodInvocation.AbstractBase
equals, hashCode, isValid
-
-
-
-
Field Detail
-
methodDescription
private final MethodDescription methodDescription
The method description that is represented by this legal special method invocation.
-
typeDescription
private final TypeDescription typeDescription
The type description that is represented by this legal special method invocation.
-
stackManipulation
private final StackManipulation stackManipulation
A stack manipulation representing the method's invocation on the type description.
-
-
Constructor Detail
-
Simple
protected Simple(MethodDescription methodDescription, TypeDescription typeDescription, StackManipulation stackManipulation)
Creates a new legal special method invocation.- Parameters:
methodDescription
- The method that represents the special method invocation.typeDescription
- The type on which the method should be invoked on by anINVOKESPECIAL
invocation.stackManipulation
- The stack manipulation that represents this special method invocation.
-
-
Method Detail
-
of
public static Implementation.SpecialMethodInvocation of(MethodDescription methodDescription, TypeDescription typeDescription)
Creates a special method invocation for a given invocation target.- Parameters:
methodDescription
- The method that represents the special method invocation.typeDescription
- The type on which the method should be invoked on by anINVOKESPECIAL
invocation.- Returns:
- A special method invocation representing a legal invocation if the method can be invoked specially on the target type or an illegal invocation if this is not possible.
-
getMethodDescription
public MethodDescription getMethodDescription()
Returns the method that represents this special method invocation. This method can be different even for equal special method invocations, dependant on the method that was used to request such an invocation by the means of aImplementation.Target
.- Returns:
- The method description that describes this instances invocation target.
-
getTypeDescription
public TypeDescription getTypeDescription()
Returns the target type the represented method is invoked on.- Returns:
- The type the represented method is invoked on.
-
apply
public StackManipulation.Size apply(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext)
Applies the stack manipulation that is described by this instance.- Parameters:
methodVisitor
- The method visitor used to write the method implementation to.implementationContext
- The context of the current implementation.- Returns:
- The changes to the size of the operand stack that are implied by this stack manipulation.
-
withCheckedCompatibilityTo
public Implementation.SpecialMethodInvocation withCheckedCompatibilityTo(MethodDescription.TypeToken token)
Checks that this special method invocation is compatible with the supplied type representation.- Parameters:
token
- The type token to check against.- Returns:
- This special method invocation or an illegal invocation if the method invocation is not applicable.
-
-