Package net.bytebuddy.dynamic.scaffold
Class TypeWriter.MethodPool.Record.ForDefinedMethod.WithBody
- java.lang.Object
-
- net.bytebuddy.dynamic.scaffold.TypeWriter.MethodPool.Record.ForDefinedMethod
-
- net.bytebuddy.dynamic.scaffold.TypeWriter.MethodPool.Record.ForDefinedMethod.WithBody
-
- All Implemented Interfaces:
TypeWriter.MethodPool.Record
- Enclosing class:
- TypeWriter.MethodPool.Record.ForDefinedMethod
@Enhance public static class TypeWriter.MethodPool.Record.ForDefinedMethod.WithBody extends TypeWriter.MethodPool.Record.ForDefinedMethod
Describes an entry that defines a method as byte code.
-
-
Nested Class Summary
-
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.dynamic.scaffold.TypeWriter.MethodPool.Record
TypeWriter.MethodPool.Record.AccessBridgeWrapper, TypeWriter.MethodPool.Record.ForDefinedMethod, TypeWriter.MethodPool.Record.ForNonImplementedMethod, TypeWriter.MethodPool.Record.Sort
-
-
Field Summary
Fields Modifier and Type Field Description private ByteCodeAppender
byteCodeAppender
The byte code appender to apply.private MethodAttributeAppender
methodAttributeAppender
The method attribute appender to apply.private MethodDescription
methodDescription
The implemented method.private Visibility
visibility
The represented method's minimum visibility.
-
Constructor Summary
Constructors Constructor Description WithBody(MethodDescription methodDescription, ByteCodeAppender byteCodeAppender)
Creates a new record for an implemented method without attributes or a modifier resolver.WithBody(MethodDescription methodDescription, ByteCodeAppender byteCodeAppender, MethodAttributeAppender methodAttributeAppender, Visibility visibility)
Creates a new entry for a method that defines a method as byte code.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.TypeWriter.MethodPool.Record
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 Detail
-
methodDescription
private final MethodDescription methodDescription
The implemented method.
-
byteCodeAppender
private final ByteCodeAppender byteCodeAppender
The byte code appender to apply.
-
methodAttributeAppender
private final MethodAttributeAppender methodAttributeAppender
The method attribute appender to apply.
-
visibility
private final Visibility visibility
The represented method's minimum visibility.
-
-
Constructor Detail
-
WithBody
public WithBody(MethodDescription methodDescription, ByteCodeAppender byteCodeAppender)
Creates a new record for an implemented method without attributes or a modifier resolver.- Parameters:
methodDescription
- The implemented method.byteCodeAppender
- The byte code appender to apply.
-
WithBody
public WithBody(MethodDescription methodDescription, ByteCodeAppender byteCodeAppender, MethodAttributeAppender methodAttributeAppender, Visibility visibility)
Creates a new entry for a method that defines a method as byte code.- Parameters:
methodDescription
- The implemented method.byteCodeAppender
- The byte code appender to apply.methodAttributeAppender
- The method attribute appender to apply.visibility
- The represented method's minimum visibility.
-
-
Method Detail
-
getMethod
public MethodDescription 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
.- Returns:
- The implemented method.
-
getSort
public TypeWriter.MethodPool.Record.Sort getSort()
Returns the sort of this method instrumentation.- Returns:
- The sort of this method instrumentation.
-
getVisibility
public Visibility getVisibility()
The visibility to enforce for this method.- Returns:
- The visibility to enforce for this method.
-
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
.- 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
.- 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
.- 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
.- 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.
-
prepend
public TypeWriter.MethodPool.Record prepend(ByteCodeAppender byteCodeAppender)
Prepends the given method appender to this entry.- Parameters:
byteCodeAppender
- The byte code appender to prepend.- Returns:
- This entry with the given code prepended.
-
-