Package net.bytebuddy.dynamic.scaffold
Class TypeWriter.MethodPool.Record.AccessBridgeWrapper
- java.lang.Object
-
- net.bytebuddy.dynamic.scaffold.TypeWriter.MethodPool.Record.AccessBridgeWrapper
-
- All Implemented Interfaces:
TypeWriter.MethodPool.Record
- Enclosing interface:
- TypeWriter.MethodPool.Record
public static class TypeWriter.MethodPool.Record.AccessBridgeWrapper extends java.lang.Object implements TypeWriter.MethodPool.Record
A wrapper that appends accessor bridges for a method's implementation. The bridges are only added ifTypeWriter.MethodPool.Record.apply(ClassVisitor, Implementation.Context, AnnotationValueFilter.Factory)
is invoked such that bridges are not appended for methods that are rebased or redefined as such types already have bridge methods in place.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
TypeWriter.MethodPool.Record.AccessBridgeWrapper.AccessorBridge
A method representing an accessor bridge method.protected static class
TypeWriter.MethodPool.Record.AccessBridgeWrapper.BridgeTarget
A method representing a bridge's target method in its defined shape.-
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
-
-
Constructor Summary
Constructors Modifier Constructor Description 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.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
apply(org.objectweb.asm.ClassVisitor classVisitor, Implementation.Context implementationContext, AnnotationValueFilter.Factory annotationValueFilterFactory)
Applies this method entry.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.ByteCodeAppender.Size
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.MethodDescription
getMethod()
Returns the method that is implemented where the returned method resembles a potential transformation.TypeWriter.MethodPool.Record.Sort
getSort()
Returns the sort of this method instrumentation.Visibility
getVisibility()
The visibility to enforce for this method.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.TypeWriter.MethodPool.Record
prepend(ByteCodeAppender byteCodeAppender)
Prepends the given method appender to this entry.
-
-
-
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.
-
getSort
public TypeWriter.MethodPool.Record.Sort getSort()
Description copied from interface:TypeWriter.MethodPool.Record
Returns the sort of this method instrumentation.- Specified by:
getSort
in interfaceTypeWriter.MethodPool.Record
- Returns:
- The sort of this method instrumentation.
-
getMethod
public MethodDescription getMethod()
Description copied from interface:TypeWriter.MethodPool.Record
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.
-
getVisibility
public Visibility getVisibility()
Description copied from interface:TypeWriter.MethodPool.Record
The visibility to enforce for this method.- Specified by:
getVisibility
in interfaceTypeWriter.MethodPool.Record
- Returns:
- The visibility to enforce for this method.
-
prepend
public TypeWriter.MethodPool.Record prepend(ByteCodeAppender byteCodeAppender)
Description copied from interface:TypeWriter.MethodPool.Record
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.
-
apply
public void apply(org.objectweb.asm.ClassVisitor classVisitor, Implementation.Context implementationContext, AnnotationValueFilter.Factory annotationValueFilterFactory)
Description copied from interface:TypeWriter.MethodPool.Record
Applies this method entry. This method can always be called and might be a no-op.- Specified by:
apply
in interfaceTypeWriter.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)
Description copied from interface:TypeWriter.MethodPool.Record
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)
Description copied from interface:TypeWriter.MethodPool.Record
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)
Description copied from interface:TypeWriter.MethodPool.Record
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)
Description copied from interface:TypeWriter.MethodPool.Record
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.
-
-