Package net.bytebuddy.implementation
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
public static interface Implementation.Context extends MethodAccessorFactory
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 aMethodVisitor. As such, an implementation context and aMethodVisitorare complementary for creating an new Java type.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classImplementation.Context.DefaultA default implementation of anImplementation.Context.ExtractableViewwhich serves as its ownMethodAccessorFactory.static classImplementation.Context.DisabledAn implementation context that does not allow for any injections into the static initializer block.static interfaceImplementation.Context.ExtractableViewRepresents an extractable view of anImplementation.Contextwhich allows the retrieval of any registered auxiliary type.static interfaceImplementation.Context.FactoryA factory for creating a new implementation context.static classImplementation.Context.FrameGenerationIndicates the frame generation being applied.-
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.MethodAccessorFactory
MethodAccessorFactory.AccessType, MethodAccessorFactory.Illegal
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description FieldDescription.InDefinedShapecache(StackManipulation fieldValue, TypeDescription fieldType)Caches a single value by storing it in form of aprivate,finalandstaticfield.ClassFileVersiongetClassFileVersion()Returns the class file version of the currently creatgetClassFileVersioned dynamic type.Implementation.Context.FrameGenerationgetFrameGeneration()Returnstrueif the explicit generation of stack map frames is expected.TypeDescriptiongetInstrumentedType()Returns the instrumented type of the current implementation.TypeDescriptionregister(AuxiliaryType auxiliaryType)Registers an auxiliary type as required for the current implementation.-
Methods inherited from interface net.bytebuddy.implementation.MethodAccessorFactory
registerAccessorFor, registerGetterFor, registerSetterFor
-
-
-
-
Method Detail
-
register
TypeDescription register(AuxiliaryType auxiliaryType)
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
FieldDescription.InDefinedShape cache(StackManipulation fieldValue, TypeDescription fieldType)
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.
-
-