Interface ConstructorStrategy
-
- All Known Implementing Classes:
ByteBuddy.RecordConstructorStrategy
,ConstructorStrategy.Default
,ConstructorStrategy.Default.WithMethodAttributeAppenderFactory
,ConstructorStrategy.ForDefaultConstructor
public interface ConstructorStrategy
A constructor strategy is responsible for creating bootstrap constructors for aSubclassDynamicTypeBuilder
.- See Also:
ConstructorStrategy.Default
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
ConstructorStrategy.Default
Default implementations of constructor strategies.static class
ConstructorStrategy.ForDefaultConstructor
A constructor strategy that creates a default constructor that invokes a super constructor with default arguments.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.List<MethodDescription.Token>
extractConstructors(TypeDescription instrumentedType)
Extracts constructors for a given super type.MethodRegistry
inject(TypeDescription instrumentedType, MethodRegistry methodRegistry)
Returns a method registry that is capable of creating byte code for the constructors that were provided by theextractConstructors(TypeDescription)
method of this instance.
-
-
-
Method Detail
-
extractConstructors
java.util.List<MethodDescription.Token> extractConstructors(TypeDescription instrumentedType)
Extracts constructors for a given super type. The extracted constructor signatures will then be imitated by the created dynamic type.- Parameters:
instrumentedType
- The type for which the constructors should be created.- Returns:
- A list of tokens that describe the constructors that are to be implemented.
-
inject
MethodRegistry inject(TypeDescription instrumentedType, MethodRegistry methodRegistry)
Returns a method registry that is capable of creating byte code for the constructors that were provided by theextractConstructors(TypeDescription)
method of this instance.- Parameters:
instrumentedType
- The instrumented type.methodRegistry
- The original method registry.- Returns:
- A method registry that is capable of providing byte code for the constructors that were added by this strategy.
-
-