Package net.bytebuddy.build
Class AccessControllerPlugin.Initializer
- java.lang.Object
-
- net.bytebuddy.build.AccessControllerPlugin.Initializer
-
- All Implemented Interfaces:
ByteCodeAppender
- Direct Known Subclasses:
AccessControllerPlugin.Initializer.WithoutProperty,AccessControllerPlugin.Initializer.WithProperty
- Enclosing class:
- AccessControllerPlugin
@Enhance protected abstract static class AccessControllerPlugin.Initializer extends java.lang.Object implements ByteCodeAppender
A byte code appender to create an initializer segment that determines if thejava.security.AccessControlleris available.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classAccessControllerPlugin.Initializer.WithoutPropertyAn initializer that always uses the access controller if it is available.protected static classAccessControllerPlugin.Initializer.WithPropertyAn initializer that uses a property to determine if the access controller should be actually used even if it is available.-
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.bytecode.ByteCodeAppender
ByteCodeAppender.Compound, ByteCodeAppender.Simple, ByteCodeAppender.Size
-
-
Field Summary
Fields Modifier and Type Field Description private TypeDescriptioninstrumentedTypeThe instrumented type.private java.lang.StringnameThe name of the field to determine the use of access controller dispatch.
-
Constructor Summary
Constructors Modifier Constructor Description protectedInitializer(TypeDescription instrumentedType, java.lang.String name)Creates a new initializer.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ByteCodeAppender.Sizeapply(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext, MethodDescription instrumentedMethod)Applies this byte code appender to a type creation process.protected abstract intonAccessController(org.objectweb.asm.MethodVisitor methodVisitor)Invoked to determine if the access controller should be used after the class was found.
-
-
-
Field Detail
-
instrumentedType
private final TypeDescription instrumentedType
The instrumented type.
-
name
private final java.lang.String name
The name of the field to determine the use of access controller dispatch.
-
-
Constructor Detail
-
Initializer
protected Initializer(TypeDescription instrumentedType, java.lang.String name)
Creates a new initializer.- Parameters:
instrumentedType- The instrumented type.name- The name of the field to determine the use of access controller dispatch.
-
-
Method Detail
-
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:
applyin 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.
-
onAccessController
protected abstract int onAccessController(org.objectweb.asm.MethodVisitor methodVisitor)
Invoked to determine if the access controller should be used after the class was found.- Parameters:
methodVisitor- The method visitor to dispatch to.- Returns:
- The size of the stack required to implement the implemented dispatch.
-
-