Class TypeWriter.MethodPool.Record.AccessBridgeWrapper

    • Field Detail

      • instrumentedType

        private final TypeDescription instrumentedType
        The instrumented type that defines the bridge methods and the bridge target.
      • bridgeTarget

        private final MethodDescription bridgeTarget
        The target of the bridge method.
      • bridgeTypes

        private final java.util.Set<MethodDescription.TypeToken> bridgeTypes
        A collection of all tokens representing all bridge methods.
      • attributeAppender

        private final MethodAttributeAppender attributeAppender
        The attribute appender being applied for the bridge target.
    • Constructor Detail

      • AccessBridgeWrapper

        protected AccessBridgeWrapper​(TypeWriter.MethodPool.Record delegate,
                                      TypeDescription instrumentedType,
                                      MethodDescription bridgeTarget,
                                      java.util.Set<MethodDescription.TypeToken> bridgeTypes,
                                      MethodAttributeAppender attributeAppender)
        Creates a wrapper for adding accessor bridges.
        Parameters:
        delegate - The delegate for implementing the bridge's target.
        instrumentedType - The instrumented type that defines the bridge methods and the bridge target.
        bridgeTarget - The target of the bridge method.
        bridgeTypes - A collection of all tokens representing all bridge methods.
        attributeAppender - The attribute appender being applied for the bridge target.
    • Method Detail

      • of

        public static TypeWriter.MethodPool.Record of​(TypeWriter.MethodPool.Record delegate,
                                                      TypeDescription instrumentedType,
                                                      MethodDescription bridgeTarget,
                                                      java.util.Set<MethodDescription.TypeToken> bridgeTypes,
                                                      MethodAttributeAppender attributeAppender)
        Wraps the given record in an accessor bridge wrapper if necessary.
        Parameters:
        delegate - The delegate for implementing the bridge's target.
        instrumentedType - The instrumented type that defines the bridge methods and the bridge target.
        bridgeTarget - The bridge methods' target methods.
        bridgeTypes - A collection of all tokens representing all bridge methods.
        attributeAppender - The attribute appender being applied for the bridge target.
        Returns:
        The given record wrapped by a bridge method wrapper if necessary.
      • apply

        public void apply​(org.objectweb.asm.ClassVisitor classVisitor,
                          Implementation.Context implementationContext,
                          AnnotationValueFilter.Factory annotationValueFilterFactory)
        Applies this method entry. This method can always be called and might be a no-op.
        Specified by:
        apply in interface TypeWriter.MethodPool.Record
        Parameters:
        classVisitor - The class visitor to which this entry should be applied.
        implementationContext - The implementation context to which this entry should be applied.
        annotationValueFilterFactory - The annotation value filter factory to apply when writing annotations.
      • applyHead

        public void applyHead​(org.objectweb.asm.MethodVisitor methodVisitor)
        Applies the head of this entry. Applying an entry is only possible if a method is defined, i.e. the sort of this entry is not TypeWriter.MethodPool.Record.Sort.SKIPPED.
        Specified by:
        applyHead in interface TypeWriter.MethodPool.Record
        Parameters:
        methodVisitor - The method visitor to which this entry should be applied.
      • applyBody

        public void applyBody​(org.objectweb.asm.MethodVisitor methodVisitor,
                              Implementation.Context implementationContext,
                              AnnotationValueFilter.Factory annotationValueFilterFactory)
        Applies the body of this entry. Applying the body of an entry is only possible if a method is implemented, i.e. the sort of this entry is TypeWriter.MethodPool.Record.Sort.IMPLEMENTED.
        Specified by:
        applyBody in interface TypeWriter.MethodPool.Record
        Parameters:
        methodVisitor - The method visitor to which this entry should be applied.
        implementationContext - The implementation context to which this entry should be applied.
        annotationValueFilterFactory - The annotation value filter factory to apply when writing annotations.
      • applyAttributes

        public void applyAttributes​(org.objectweb.asm.MethodVisitor methodVisitor,
                                    AnnotationValueFilter.Factory annotationValueFilterFactory)
        Applies the attributes of this entry. Applying the body of an entry is only possible if a method is implemented, i.e. the sort of this entry is TypeWriter.MethodPool.Record.Sort.DEFINED.
        Specified by:
        applyAttributes in interface TypeWriter.MethodPool.Record
        Parameters:
        methodVisitor - The method visitor to which this entry should be applied.
        annotationValueFilterFactory - The annotation value filter factory to apply when writing annotations.
      • applyCode

        public ByteCodeAppender.Size applyCode​(org.objectweb.asm.MethodVisitor methodVisitor,
                                               Implementation.Context implementationContext)
        Applies the code of this entry. Applying the body of an entry is only possible if a method is implemented, i.e. the sort of this entry is TypeWriter.MethodPool.Record.Sort.IMPLEMENTED.
        Specified by:
        applyCode in interface TypeWriter.MethodPool.Record
        Parameters:
        methodVisitor - The method visitor to which this entry should be applied.
        implementationContext - The implementation context to which this entry should be applied.
        Returns:
        The size requirements of the implemented code.