@HashCodeAndEqualsPlugin.Enhance public class TypeProxy extends java.lang.Object implements AuxiliaryType
Modifier and Type | Class and Description |
---|---|
protected static class |
TypeProxy.AbstractMethodErrorThrow
A stack manipulation that throws an abstract method error in case that a given super method cannot be invoked.
|
static class |
TypeProxy.ForDefaultMethod
Creates a type proxy which delegates its super method calls to any invokable default method of
a given interface and loads an instance of this proxy onto the operand stack.
|
static class |
TypeProxy.ForSuperMethodByConstructor
Loads a type proxy onto the operand stack which is created by calling one of its constructors.
|
static class |
TypeProxy.ForSuperMethodByReflectionFactory
Loads a type proxy onto the operand stack which is created by constructing a serialization constructor using
the Oracle JDK's
ReflectionFactory.newConstructorForSerialization(Class, java.lang.reflect.Constructor)
method which might not be available in any Java runtime. |
static interface |
TypeProxy.InvocationFactory
An invocation factory is responsible for creating a special method invocation for any method that is to be
invoked.
|
protected class |
TypeProxy.MethodCall
An implementation for a method call of a
TypeProxy . |
protected static class |
TypeProxy.SilentConstruction
An implementation of a silent construction of a given type by using the non-standardized
ReflectionFactory . |
AuxiliaryType.NamingStrategy, AuxiliaryType.SignatureRelevant
Modifier and Type | Field and Description |
---|---|
private boolean |
ignoreFinalizer
true if the finalizer method should not be instrumented. |
private Implementation.Target |
implementationTarget
The implementation target of the proxied type.
|
static java.lang.String |
INSTANCE_FIELD
The name of the field that stores the delegation instance.
|
private TypeProxy.InvocationFactory |
invocationFactory
The invocation factory for creating special method invocations.
|
private TypeDescription |
proxiedType
The type that is proxied, i.e.
|
static java.lang.String |
REFLECTION_METHOD
The name of the
static method that is added to this auxiliary type for creating instances by using the
Oracle JDK's ReflectionFactory . |
private boolean |
serializableProxy
Determines if the proxy should be serializable.
|
DEFAULT_TYPE_MODIFIER
Constructor and Description |
---|
TypeProxy(TypeDescription proxiedType,
Implementation.Target implementationTarget,
TypeProxy.InvocationFactory invocationFactory,
boolean ignoreFinalizer,
boolean serializableProxy)
Creates a new type proxy.
|
Modifier and Type | Method and Description |
---|---|
DynamicType |
make(java.lang.String auxiliaryTypeName,
ClassFileVersion classFileVersion,
MethodAccessorFactory methodAccessorFactory)
Creates a new auxiliary type.
|
public static final java.lang.String REFLECTION_METHOD
static
method that is added to this auxiliary type for creating instances by using the
Oracle JDK's ReflectionFactory
.public static final java.lang.String INSTANCE_FIELD
private final TypeDescription proxiedType
private final Implementation.Target implementationTarget
private final TypeProxy.InvocationFactory invocationFactory
private final boolean ignoreFinalizer
true
if the finalizer method should not be instrumented.private final boolean serializableProxy
public TypeProxy(TypeDescription proxiedType, Implementation.Target implementationTarget, TypeProxy.InvocationFactory invocationFactory, boolean ignoreFinalizer, boolean serializableProxy)
proxiedType
- The type this proxy should implement which can either be a non-final class or an interface.implementationTarget
- The implementation target this type proxy is created for.invocationFactory
- The invocation factory for creating special method invocations.ignoreFinalizer
- true
if any finalizer methods should be ignored for proxying.serializableProxy
- Determines if the proxy should be serializable.public DynamicType make(java.lang.String auxiliaryTypeName, ClassFileVersion classFileVersion, MethodAccessorFactory methodAccessorFactory)
make
in interface AuxiliaryType
auxiliaryTypeName
- The fully qualified binary name for this auxiliary type. The type should be in
the same package than the instrumented type this auxiliary type is providing services
to in order to allow package-private access.classFileVersion
- The class file version the auxiliary class should be written in.methodAccessorFactory
- A factory for accessor methods.