public static enum ConstructorStrategy.Default extends Enum<ConstructorStrategy.Default> implements ConstructorStrategy
NO_CONSTRUCTORS
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_CONSTRUCTOR
strategy is adding a default constructor that calls it's super types default constructor. If no such constructor is defined,
an IllegalArgumentException
is thrown. Only public
or protected
constructors are considered
by this strategy.IMITATE_SUPER_TYPE
strategy is adding all constructors of the super type which are making direct calls to their super constructor of
same signature. Only public
or protected
constructors are considered by this strategy.ConstructorStrategy.Default
Enum Constant and Description |
---|
DEFAULT_CONSTRUCTOR |
IMITATE_SUPER_TYPE |
NO_CONSTRUCTORS |
Modifier and Type | Method and Description |
---|---|
MethodList |
extractConstructors(TypeDescription superType)
Extracts constructors for a given super type.
|
MethodRegistry |
inject(MethodRegistry methodRegistry,
MethodAttributeAppender.Factory defaultMethodAttributeAppenderFactory)
Returns a method registry that is capable of creating byte code for the constructors that were
provided by the
ConstructorStrategy.extractConstructors(net.bytebuddy.instrumentation.type.TypeDescription)
method of this instance. |
static ConstructorStrategy.Default |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static ConstructorStrategy.Default[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final ConstructorStrategy.Default NO_CONSTRUCTORS
public static final ConstructorStrategy.Default DEFAULT_CONSTRUCTOR
public static final ConstructorStrategy.Default IMITATE_SUPER_TYPE
public static ConstructorStrategy.Default[] values()
for (ConstructorStrategy.Default c : ConstructorStrategy.Default.values()) System.out.println(c);
public static ConstructorStrategy.Default valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic MethodList extractConstructors(TypeDescription superType)
ConstructorStrategy
extractConstructors
in interface ConstructorStrategy
superType
- The super type from which constructors are to be extracted.superType
is the direct super type of the instrumented type.public MethodRegistry inject(MethodRegistry methodRegistry, MethodAttributeAppender.Factory defaultMethodAttributeAppenderFactory)
ConstructorStrategy
ConstructorStrategy.extractConstructors(net.bytebuddy.instrumentation.type.TypeDescription)
method of this instance.inject
in interface ConstructorStrategy
methodRegistry
- The original method registry.defaultMethodAttributeAppenderFactory
- The default method attribute appender factory.Copyright © 2014. All rights reserved.