Package net.bytebuddy.dynamic.scaffold
Class TypeWriter.MethodPool.Record.ForDefinedMethod.OfVisibilityBridge
java.lang.Object
net.bytebuddy.dynamic.scaffold.TypeWriter.MethodPool.Record.ForDefinedMethod
net.bytebuddy.dynamic.scaffold.TypeWriter.MethodPool.Record.ForDefinedMethod.OfVisibilityBridge
- All Implemented Interfaces:
TypeWriter.MethodPool.Record
,ByteCodeAppender
- Enclosing class:
TypeWriter.MethodPool.Record.ForDefinedMethod
@Enhance
public static class TypeWriter.MethodPool.Record.ForDefinedMethod.OfVisibilityBridge
extends TypeWriter.MethodPool.Record.ForDefinedMethod
implements ByteCodeAppender
A record for a visibility bridge.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
A method describing a visibility bridge.Nested classes/interfaces inherited from class net.bytebuddy.dynamic.scaffold.TypeWriter.MethodPool.Record.ForDefinedMethod
TypeWriter.MethodPool.Record.ForDefinedMethod.OfVisibilityBridge, TypeWriter.MethodPool.Record.ForDefinedMethod.WithAnnotationDefaultValue, TypeWriter.MethodPool.Record.ForDefinedMethod.WithBody, TypeWriter.MethodPool.Record.ForDefinedMethod.WithoutBody
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.bytecode.ByteCodeAppender
ByteCodeAppender.Compound, ByteCodeAppender.Simple, ByteCodeAppender.Size
Nested classes/interfaces inherited from interface net.bytebuddy.dynamic.scaffold.TypeWriter.MethodPool.Record
TypeWriter.MethodPool.Record.AccessBridgeWrapper, TypeWriter.MethodPool.Record.ForDefinedMethod, TypeWriter.MethodPool.Record.ForNonImplementedMethod, TypeWriter.MethodPool.Record.Sort
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final MethodAttributeAppender
The attribute appender to apply to the visibility bridge.private final MethodDescription
The method the visibility bridge invokes.private final TypeDescription
The type on which the bridge method is invoked.private final MethodDescription
The visibility bridge. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
OfVisibilityBridge
(MethodDescription visibilityBridge, MethodDescription bridgeTarget, TypeDescription bridgeType, MethodAttributeAppender attributeAppender) Creates a new record for a visibility bridge. -
Method Summary
Modifier and TypeMethodDescriptionapply
(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext, MethodDescription instrumentedMethod) Applies this byte code appender to a type creation process.void
applyAttributes
(org.objectweb.asm.MethodVisitor methodVisitor, AnnotationValueFilter.Factory annotationValueFilterFactory) Applies the attributes of this entry.void
applyBody
(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext, AnnotationValueFilter.Factory annotationValueFilterFactory) Applies the body of this entry.applyCode
(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext) Applies the code of this entry.void
applyHead
(org.objectweb.asm.MethodVisitor methodVisitor) Applies the head of this entry.Returns the method that is implemented where the returned method resembles a potential transformation.getSort()
Returns the sort of this method instrumentation.The visibility to enforce for this method.static TypeWriter.MethodPool.Record
of
(TypeDescription instrumentedType, MethodDescription bridgeTarget, MethodAttributeAppender attributeAppender) Creates a record for a visibility bridge.prepend
(ByteCodeAppender byteCodeAppender) Prepends the given method appender to this entry.Methods inherited from class net.bytebuddy.dynamic.scaffold.TypeWriter.MethodPool.Record.ForDefinedMethod
apply
-
Field Details
-
visibilityBridge
The visibility bridge. -
bridgeTarget
The method the visibility bridge invokes. -
bridgeType
The type on which the bridge method is invoked. -
attributeAppender
The attribute appender to apply to the visibility bridge.
-
-
Constructor Details
-
OfVisibilityBridge
protected OfVisibilityBridge(MethodDescription visibilityBridge, MethodDescription bridgeTarget, TypeDescription bridgeType, MethodAttributeAppender attributeAppender) Creates a new record for a visibility bridge.- Parameters:
visibilityBridge
- The visibility bridge.bridgeTarget
- The method the visibility bridge invokes.bridgeType
- The type of the instrumented type.attributeAppender
- The attribute appender to apply to the visibility bridge.
-
-
Method Details
-
of
public static TypeWriter.MethodPool.Record of(TypeDescription instrumentedType, MethodDescription bridgeTarget, MethodAttributeAppender attributeAppender) Creates a record for a visibility bridge.- Parameters:
instrumentedType
- The instrumented type.bridgeTarget
- The target method of the visibility bridge.attributeAppender
- The attribute appender to apply to the visibility bridge.- Returns:
- A record describing the visibility bridge.
-
getMethod
Returns the method that is implemented where the returned method resembles a potential transformation. An implemented method is only defined if a method is notTypeWriter.MethodPool.Record.Sort.SKIPPED
.- Specified by:
getMethod
in interfaceTypeWriter.MethodPool.Record
- Returns:
- The implemented method.
-
getSort
Returns the sort of this method instrumentation.- Specified by:
getSort
in interfaceTypeWriter.MethodPool.Record
- Returns:
- The sort of this method instrumentation.
-
getVisibility
The visibility to enforce for this method.- Specified by:
getVisibility
in interfaceTypeWriter.MethodPool.Record
- Returns:
- The visibility to enforce for this method.
-
prepend
Prepends the given method appender to this entry.- Specified by:
prepend
in interfaceTypeWriter.MethodPool.Record
- Parameters:
byteCodeAppender
- The byte code appender to prepend.- Returns:
- This entry with the given code prepended.
-
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 notTypeWriter.MethodPool.Record.Sort.SKIPPED
.- Specified by:
applyHead
in interfaceTypeWriter.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 isTypeWriter.MethodPool.Record.Sort.IMPLEMENTED
.- Specified by:
applyBody
in interfaceTypeWriter.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 isTypeWriter.MethodPool.Record.Sort.DEFINED
.- Specified by:
applyAttributes
in interfaceTypeWriter.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 isTypeWriter.MethodPool.Record.Sort.IMPLEMENTED
.- Specified by:
applyCode
in interfaceTypeWriter.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.
-
apply
public ByteCodeAppender.Size apply(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext, MethodDescription instrumentedMethod) Applies this byte code appender to a type creation process.- Specified by:
apply
in interfaceByteCodeAppender
- Parameters:
methodVisitor
- The method visitor to which the byte code appender writes its code to.implementationContext
- The implementation context of the current type creation process.instrumentedMethod
- The method that is the target of the instrumentation.- Returns:
- The required size for the applied byte code to run.
-