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.AccessController
is available.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
AccessControllerPlugin.Initializer.WithoutProperty
An initializer that always uses the access controller if it is available.protected static class
AccessControllerPlugin.Initializer.WithProperty
An 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 TypeDescription
instrumentedType
The instrumented type.private java.lang.String
name
The name of the field to determine the use of access controller dispatch.
-
Constructor Summary
Constructors Modifier Constructor Description protected
Initializer(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.Size
apply(org.objectweb.asm.MethodVisitor methodVisitor, Implementation.Context implementationContext, MethodDescription instrumentedMethod)
Applies this byte code appender to a type creation process.protected abstract int
onAccessController(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:
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.
-
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.
-
-