SubclassDynamicTypeBuilder.
net.bytebuddy.dynamic.scaffold.subclass.ConstructorStrategy.Default
| Modifier and Type | Class and Description |
|---|---|
| public static enum | ConstructorStrategy.Default
Default implementations of constructor strategies. |
| public static class | ConstructorStrategy.ForDefaultConstructor
A constructor strategy that creates a default constructor that invokes a super constructor with default arguments. |
| Modifier and Type | Method and Description |
|---|---|
| public List | Returns: A list of tokens that describe the constructors that are to be implemented.The type for which the constructors should be created. instrumentedType)Extracts constructors for a given super type. |
| public MethodRegistry | Returns: A method registry that is capable of providing byte code for the constructors that were added by this strategy.The instrumented type. instrumentedType, MethodRegistry The original method registry. methodRegistry)Returns a method registry that is capable of creating byte code for the constructors that were
provided by the
|
| extractConstructors | back to summary |
|---|---|
| public List Extracts constructors for a given super type. The extracted constructor signatures will then be imitated by the created dynamic type.
| |
| inject | back to summary |
|---|---|
| public MethodRegistry inject(TypeDescription instrumentedType, MethodRegistry methodRegistry) Returns a method registry that is capable of creating byte code for the constructors that were
provided by the
| |
MethodAttributeAppender.Factory .
| Modifier and Type | Class and Description |
|---|---|
| protected static class | ConstructorStrategy.Default.WithMethodAttributeAppenderFactory
A wrapper for a default constructor strategy which additionally applies a method attribute appender factory. |
| Modifier and Type | Field and Description |
|---|---|
| public static final ConstructorStrategy. | DEFAULT_CONSTRUCTOR
This strategy is adding a default constructor that calls its super types default constructor. |
| public static final ConstructorStrategy. | IMITATE_SUPER_CLASS
This strategy is adding all constructors of the instrumented type's super class where each constructor is directly invoking its signature-equivalent super class constructor. |
| public static final ConstructorStrategy. | IMITATE_SUPER_CLASS_OPENING
This strategy is adding all constructors of the instrumented type's super class where each constructor is directly invoking its signature-equivalent super class constructor. |
| public static final ConstructorStrategy. | IMITATE_SUPER_CLASS_PUBLIC
This strategy is adding all constructors of the instrumented type's super class where each constructor is directly invoking its signature-equivalent super class constructor. |
| public static final ConstructorStrategy. | NO_CONSTRUCTORS
This strategy is adding no constructors such that the instrumented type will by default not have any. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| protected abstract List | Returns: A list of relevant method tokens.The type for which to extract the constructors. instrumentedType)Extracts the relevant method tokens of the instrumented type's constructors. |
| protected abstract MethodRegistry | Returns: The resulting method registry.The method registry into which to inject the constructors. methodRegistry, MethodAttributeAppender.The method attribute appender to use. methodAttributeAppenderFactoryApplies the actual injection with a method attribute appender factory supplied. |
| public List | extractConstructors(TypeDescription
The type for which the constructors should be created. instrumentedType)Implements net. |
| public MethodRegistry | inject(TypeDescription
The instrumented type. instrumentedType, MethodRegistry The original method registry. methodRegistry)Implements net. net.
method of this instance.
|
| protected int | Returns: The resolved modifiers.The actual constructor's modifiers. modifiers)Resolves a constructor's modifiers. |
| public static ConstructorStrategy. | |
| public static ConstructorStrategy. | |
| public ConstructorStrategy | Returns: A copy of this constructor strategy with the method attribute appender factory applied.The method attribute appender factory to use. methodAttributeAppenderFactoryReturns a constructor strategy that supplies the supplied method attribute appender factory. |
| public ConstructorStrategy | Returns: A copy of this constructor strategy which retains any of the base constructor's annotations.Applies this constructor strategy while retaining any of the base constructor's annotations. |
| DEFAULT_CONSTRUCTOR | back to summary |
|---|---|
| public static final ConstructorStrategy. This strategy is adding a default constructor that calls its super types default constructor. If no such
constructor is defined by the super class, an | |
| IMITATE_SUPER_CLASS | back to summary |
|---|---|
| public static final ConstructorStrategy. This strategy is adding all constructors of the instrumented type's super class where each constructor is directly invoking its signature-equivalent super class constructor. Only constructors that are visible to the instrumented type are added, i.e. package-private constructors are only added if the super type is defined in the same package as the instrumented type and private constructors are always skipped. | |
| IMITATE_SUPER_CLASS_OPENING | back to summary |
|---|---|
| public static final ConstructorStrategy. This strategy is adding all constructors of the instrumented type's super class where each constructor is
directly invoking its signature-equivalent super class constructor. A constructor is added for any constructor
of the super class that is invokable and is declared as | |
| IMITATE_SUPER_CLASS_PUBLIC | back to summary |
|---|---|
| public static final ConstructorStrategy. This strategy is adding all constructors of the instrumented type's super class where each constructor is
directly invoking its signature-equivalent super class constructor. Only | |
| NO_CONSTRUCTORS | back to summary |
|---|---|
| public static final ConstructorStrategy. This strategy is adding no constructors such that the instrumented type will by default not have any. This is legal by Java byte code requirements. However, if no constructor is added manually if this strategy is applied, the type is not constructable without using JVM non-public functionality. | |
| Default | back to summary |
|---|---|
| private Default() | |
| doExtractConstructors | back to summary |
|---|---|
| protected abstract List Extracts the relevant method tokens of the instrumented type's constructors.
| |
| doInject | back to summary |
|---|---|
| protected abstract MethodRegistry doInject(MethodRegistry methodRegistry, MethodAttributeAppender. Applies the actual injection with a method attribute appender factory supplied.
| |
| extractConstructors | back to summary |
|---|---|
| public List Implements net. Doc from net. Extracts constructors for a given super type. The extracted constructor signatures will then be imitated by the created dynamic type.
| |
| inject | back to summary |
|---|---|
| public MethodRegistry inject(TypeDescription instrumentedType, MethodRegistry methodRegistry) Implements net. Doc from net. Returns a method registry that is capable of creating byte code for the constructors that were
provided by the
| |
| resolveModifier | back to summary |
|---|---|
| protected int resolveModifier(int modifiers) Resolves a constructor's modifiers.
| |
| valueOf | back to summary |
|---|---|
| public static ConstructorStrategy. | |
| values | back to summary |
|---|---|
| public static ConstructorStrategy. | |
| with | back to summary |
|---|---|
| public ConstructorStrategy with(MethodAttributeAppender. Returns a constructor strategy that supplies the supplied method attribute appender factory.
| |
| withInheritedAnnotations | back to summary |
|---|---|
| public ConstructorStrategy withInheritedAnnotations() Applies this constructor strategy while retaining any of the base constructor's annotations.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final ConstructorStrategy. | delegate
The delegate default constructor strategy. |
| private final MethodAttributeAppender. | methodAttributeAppenderFactory
The method attribute appender factory to apply. |
| Access | Constructor and Description |
|---|---|
| protected | WithMethodAttributeAppenderFactory(ConstructorStrategy.
The delegate default constructor strategy. delegate,The method attribute appender factory to apply. methodAttributeAppenderFactoryCreates a new wrapper for a default constructor strategy. |
| Modifier and Type | Method and Description |
|---|---|
| public List | extractConstructors(TypeDescription
The type for which the constructors should be created. instrumentedType)Implements net. |
| public MethodRegistry | inject(TypeDescription
The instrumented type. instrumentedType, MethodRegistry The original method registry. methodRegistry)Implements net. net.
method of this instance.
|
| delegate | back to summary |
|---|---|
| private final ConstructorStrategy. The delegate default constructor strategy. | |
| methodAttributeAppenderFactory | back to summary |
|---|---|
| private final MethodAttributeAppender. The method attribute appender factory to apply. | |
| WithMethodAttributeAppenderFactory | back to summary |
|---|---|
| protected WithMethodAttributeAppenderFactory(ConstructorStrategy. Creates a new wrapper for a default constructor strategy.
| |
| extractConstructors | back to summary |
|---|---|
| public List Implements net. Doc from net. Extracts constructors for a given super type. The extracted constructor signatures will then be imitated by the created dynamic type.
| |
| inject | back to summary |
|---|---|
| public MethodRegistry inject(TypeDescription instrumentedType, MethodRegistry methodRegistry) Implements net. Doc from net. Returns a method registry that is capable of creating byte code for the constructors that were
provided by the
| |
| Modifier and Type | Field and Description |
|---|---|
| private final ElementMatcher | elementMatcher
A matcher to select a super constructor among possible candidates. |
| private final MethodAttributeAppender. | methodAttributeAppenderFactory
The method attribute appender factory to apply. |
| Access | Constructor and Description |
|---|---|
| public | ForDefaultConstructor()
Creates a constructor strategy for invoking a super constructor with default arguments. |
| public | ForDefaultConstructor(ElementMatcher<? super MethodDescription>
A matcher to select a super constructor among possible candidates. elementMatcher)Creates a constructor strategy for invoking a super constructor with default arguments. |
| public | ForDefaultConstructor(MethodAttributeAppender.
The method attribute appender factory to apply. methodAttributeAppenderFactoryCreates a constructor strategy for invoking a super constructor with default arguments. |
| public | ForDefaultConstructor(ElementMatcher<? super MethodDescription>
A matcher to select a super constructor among possible candidates. elementMatcher, MethodAttributeAppender.The method attribute appender factory to apply. methodAttributeAppenderFactoryCreates a constructor strategy for invoking a super constructor with default arguments. |
| Modifier and Type | Method and Description |
|---|---|
| public List | extractConstructors(TypeDescription
The type for which the constructors should be created. instrumentedType)Implements net. |
| public MethodRegistry | inject(TypeDescription
The instrumented type. instrumentedType, MethodRegistry The original method registry. methodRegistry)Implements net. net.
method of this instance.
|
| elementMatcher | back to summary |
|---|---|
| private final ElementMatcher<? super MethodDescription> elementMatcher A matcher to select a super constructor among possible candidates. | |
| methodAttributeAppenderFactory | back to summary |
|---|---|
| private final MethodAttributeAppender. The method attribute appender factory to apply. | |
| ForDefaultConstructor | back to summary |
|---|---|
| public ForDefaultConstructor() Creates a constructor strategy for invoking a super constructor with default arguments. | |
| ForDefaultConstructor | back to summary |
|---|---|
| public ForDefaultConstructor(ElementMatcher<? super MethodDescription> elementMatcher) Creates a constructor strategy for invoking a super constructor with default arguments.
| |
| ForDefaultConstructor | back to summary |
|---|---|
| public ForDefaultConstructor(MethodAttributeAppender. Creates a constructor strategy for invoking a super constructor with default arguments.
| |
| ForDefaultConstructor | back to summary |
|---|---|
| public ForDefaultConstructor(ElementMatcher<? super MethodDescription> elementMatcher, MethodAttributeAppender. Creates a constructor strategy for invoking a super constructor with default arguments.
| |
| extractConstructors | back to summary |
|---|---|
| public List Implements net. Doc from net. Extracts constructors for a given super type. The extracted constructor signatures will then be imitated by the created dynamic type.
| |
| inject | back to summary |
|---|---|
| public MethodRegistry inject(TypeDescription instrumentedType, MethodRegistry methodRegistry) Implements net. Doc from net. Returns a method registry that is capable of creating byte code for the constructors that were
provided by the
| |