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 Object
implements ByteCodeAppender
A byte code appender to create an initializer segment that determines if
the
java.security.AccessController
is available.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
An initializer that always uses the access controller if it is available.protected static class
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
FieldsModifier and TypeFieldDescriptionprivate final TypeDescription
The instrumented type.private final String
The name of the field to determine the use of access controller dispatch. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Initializer
(TypeDescription instrumentedType, String name) Creates a new initializer. -
Method Summary
Modifier and TypeMethodDescriptionapply
(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 Details
-
instrumentedType
The instrumented type. -
name
The name of the field to determine the use of access controller dispatch.
-
-
Constructor Details
-
Initializer
Creates a new initializer.- Parameters:
instrumentedType
- The instrumented type.name
- The name of the field to determine the use of access controller dispatch.
-
-
Method Details
-
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.
-