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 classTypeWriter.MethodPool.Record.AccessBridgeWrapper.AccessorBridgeA method representing an accessor bridge method.protected static classTypeWriter.MethodPool.Record.AccessBridgeWrapper.BridgeTargetA 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 protectedAccessBridgeWrapper(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 voidapply(org.objectweb.asm.ClassVisitor classVisitor, Implementation.Context implementationContext, AnnotationValueFilter.Factory annotationValueFilterFactory)Applies this method entry.voidapplyAttributes(org.objectweb.asm.MethodVisitor methodVisitor, AnnotationValueFilter.Factory annotationValueFilterFactory)Applies the attributes of this entry.voidapplyBody(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext, AnnotationValueFilter.Factory annotationValueFilterFactory)Applies the body of this entry.ByteCodeAppender.SizeapplyCode(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext)Applies the code of this entry.voidapplyHead(org.objectweb.asm.MethodVisitor methodVisitor)Applies the head of this entry.MethodDescriptiongetMethod()Returns the method that is implemented where the returned method resembles a potential transformation.TypeWriter.MethodPool.Record.SortgetSort()Returns the sort of this method instrumentation.VisibilitygetVisibility()The visibility to enforce for this method.static TypeWriter.MethodPool.Recordof(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.Recordprepend(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.RecordReturns the sort of this method instrumentation.- Specified by:
getSortin interfaceTypeWriter.MethodPool.Record- Returns:
- The sort of this method instrumentation.
-
getMethod
public MethodDescription getMethod()
Description copied from interface:TypeWriter.MethodPool.RecordReturns 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:
getMethodin interfaceTypeWriter.MethodPool.Record- Returns:
- The implemented method.
-
getVisibility
public Visibility getVisibility()
Description copied from interface:TypeWriter.MethodPool.RecordThe visibility to enforce for this method.- Specified by:
getVisibilityin 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.RecordPrepends the given method appender to this entry.- Specified by:
prependin 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.RecordApplies this method entry. This method can always be called and might be a no-op.- Specified by:
applyin 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.RecordApplies 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:
applyHeadin 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.RecordApplies 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:
applyBodyin 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.RecordApplies 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:
applyAttributesin 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.RecordApplies 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:
applyCodein 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.
-
-