Class TypeProxy.ForDefaultMethod

  • All Implemented Interfaces:
    StackManipulation
    Enclosing class:
    TypeProxy

    @Enhance
    public static class TypeProxy.ForDefaultMethod
    extends java.lang.Object
    implements StackManipulation
    Creates a type proxy which delegates its super method calls to any invokable default method of a given interface and loads an instance of this proxy onto the operand stack.
    • Field Detail

      • proxiedType

        private final TypeDescription proxiedType
        The proxied interface type.
      • implementationTarget

        private final Implementation.Target implementationTarget
        The implementation target for the original instrumentation.
      • serializableProxy

        private final boolean serializableProxy
        true if the proxy should be Serializable.
    • Constructor Detail

      • ForDefaultMethod

        public ForDefaultMethod​(TypeDescription proxiedType,
                                Implementation.Target implementationTarget,
                                boolean serializableProxy)
        Creates a new proxy creation for a default interface type proxy.
        Parameters:
        proxiedType - The proxied interface type.
        implementationTarget - The implementation target for the original implementation.
        serializableProxy - true if the proxy should be Serializable.
    • Method Detail

      • isValid

        public boolean isValid()
        Determines if this stack manipulation is valid.
        Specified by:
        isValid in interface StackManipulation
        Returns:
        If false, this manipulation cannot be applied and should throw an exception.
      • apply

        public StackManipulation.Size apply​(org.objectweb.asm.MethodVisitor methodVisitor,
                                            Implementation.Context implementationContext)
        Applies the stack manipulation that is described by this instance.
        Specified by:
        apply in interface StackManipulation
        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.