Interface Implementation.Context
- All Superinterfaces:
MethodAccessorFactory
- All Known Subinterfaces:
Implementation.Context.ExtractableView
- All Known Implementing Classes:
Implementation.Context.Default, Implementation.Context.Disabled, Implementation.Context.ExtractableView.AbstractBase
- Enclosing interface:
Implementation
The context for an implementation application. An implementation context represents a mutable data structure
where any registration is irrevocable. Calling methods on an implementation context should be considered equally
sensitive as calling a
MethodVisitor. As such, an implementation context and a
MethodVisitor are complementary for creating an new Java type.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classA default implementation of anImplementation.Context.ExtractableViewwhich serves as its ownMethodAccessorFactory.static classAn implementation context that does not allow for any injections into the static initializer block.static interfaceRepresents an extractable view of anImplementation.Contextwhich allows the retrieval of any registered auxiliary type.static interfaceA factory for creating a new implementation context.static enumIndicates the frame generation being applied.Nested classes/interfaces inherited from interface MethodAccessorFactory
MethodAccessorFactory.AccessType, MethodAccessorFactory.Illegal -
Method Summary
Modifier and TypeMethodDescriptioncache(StackManipulation fieldValue, TypeDescription fieldType) Caches a single value by storing it in form of aprivate,finalandstaticfield.Returns the class file version of the currently creatgetClassFileVersioned dynamic type.Returnstrueif the explicit generation of stack map frames is expected.Returns the instrumented type of the current implementation.register(AuxiliaryType auxiliaryType) Registers an auxiliary type as required for the current implementation.Methods inherited from interface MethodAccessorFactory
registerAccessorFor, registerGetterFor, registerSetterFor
-
Method Details
-
register
Registers an auxiliary type as required for the current implementation. Registering a type will cause the creation of this type even if this type is not effectively used for the current implementation.- Parameters:
auxiliaryType- The auxiliary type that is required for the current implementation.- Returns:
- A description of the registered auxiliary type.
-
cache
Caches a single value by storing it in form of aprivate,finalandstaticfield. By caching values, expensive instance creations can be avoided and object identity can be preserved. The field is initiated in a generated class's static initializer.- Parameters:
fieldValue- A stack manipulation for creating the value that is to be cached in astaticfield. After executing the stack manipulation, exactly one value must be put onto the operand stack which is assignable to the givenfieldType.fieldType- The type of the field for storing the cached value. This field's type determines the value that is put onto the operand stack by this method's returned stack manipulation.- Returns:
- A description of a field that was defined on the instrumented type which contains the given value.
-
getInstrumentedType
TypeDescription getInstrumentedType()Returns the instrumented type of the current implementation. The instrumented type is exposed with the intend of allowing optimal byte code generation and not for implementing checks or changing the behavior of aStackManipulation.- Returns:
- The instrumented type of the current implementation.
-
getClassFileVersion
ClassFileVersion getClassFileVersion()Returns the class file version of the currently creatgetClassFileVersioned dynamic type.- Returns:
- The class file version of the currently created dynamic type.
-
getFrameGeneration
Implementation.Context.FrameGeneration getFrameGeneration()Returnstrueif the explicit generation of stack map frames is expected.- Returns:
trueif the explicit generation of stack map frames is expected.
-