Class RebaseImplementationTarget
java.lang.Object
net.bytebuddy.implementation.Implementation.Target.AbstractBase
net.bytebuddy.dynamic.scaffold.inline.RebaseImplementationTarget
- All Implemented Interfaces:
Implementation.Target
An implementation target for redefining a given type while preserving the original methods within the
instrumented type.
Super method calls are merely emulated by this
Implementation.Target
in order
to preserve Java's super call semantics a user would expect when invoking a super
-prefixed method. This
means that original methods are either moved to renamed private
methods which are never dispatched
virtually or they are invoked directly via the INVOKESPECIAL
invocation to explicitly forbid a virtual
dispatch.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A factory for creating aRebaseImplementationTarget
.protected static class
AImplementation.SpecialMethodInvocation
which invokes a rebased method as given by aMethodRebaseResolver
.Nested classes/interfaces inherited from class net.bytebuddy.implementation.Implementation.Target.AbstractBase
Implementation.Target.AbstractBase.DefaultMethodInvocation
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.Implementation.Target
Implementation.Target.AbstractBase
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map
<MethodDescription.SignatureToken, MethodRebaseResolver.Resolution> A mapping of the instrumented type's declared methods by each method's token.Fields inherited from class net.bytebuddy.implementation.Implementation.Target.AbstractBase
defaultMethodInvocation, instrumentedType, methodGraph
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
RebaseImplementationTarget
(TypeDescription instrumentedType, MethodGraph.Linked methodGraph, Implementation.Target.AbstractBase.DefaultMethodInvocation defaultMethodInvocation, Map<MethodDescription.SignatureToken, MethodRebaseResolver.Resolution> rebaseableMethods) Creates a rebase implementation target. -
Method Summary
Modifier and TypeMethodDescriptionIdentifies the origin type of an implementation.Creates a special method invocation for invoking the super method of the given method.invokeSuper
(MethodRebaseResolver.Resolution resolution) Creates a special method invocation for the given rebase resolution.invokeSuper
(MethodGraph.Node node) Creates a special method invocation for the given node.protected static Implementation.Target
of
(TypeDescription instrumentedType, MethodGraph.Linked methodGraph, ClassFileVersion classFileVersion, MethodRebaseResolver methodRebaseResolver) Creates a new rebase implementation target.Methods inherited from class net.bytebuddy.implementation.Implementation.Target.AbstractBase
getInstrumentedType, invokeDefault, invokeDefault, invokeDominant
-
Field Details
-
rebaseableMethods
private final Map<MethodDescription.SignatureToken,MethodRebaseResolver.Resolution> rebaseableMethodsA mapping of the instrumented type's declared methods by each method's token.
-
-
Constructor Details
-
RebaseImplementationTarget
protected RebaseImplementationTarget(TypeDescription instrumentedType, MethodGraph.Linked methodGraph, Implementation.Target.AbstractBase.DefaultMethodInvocation defaultMethodInvocation, Map<MethodDescription.SignatureToken, MethodRebaseResolver.Resolution> rebaseableMethods) Creates a rebase implementation target.- Parameters:
instrumentedType
- The instrumented type.methodGraph
- A method graph of the instrumented type.defaultMethodInvocation
- The default method invocation mode to apply.rebaseableMethods
- A mapping of the instrumented type's declared methods by each method's token.
-
-
Method Details
-
of
protected static Implementation.Target of(TypeDescription instrumentedType, MethodGraph.Linked methodGraph, ClassFileVersion classFileVersion, MethodRebaseResolver methodRebaseResolver) Creates a new rebase implementation target.- Parameters:
instrumentedType
- The instrumented type.methodGraph
- A method graph of the instrumented type.classFileVersion
- The type's class file version.methodRebaseResolver
- A method rebase resolver to be used when calling a rebased method.- Returns:
- An implementation target for the given input.
-
invokeSuper
Creates a special method invocation for invoking the super method of the given method.- Parameters:
token
- A token of the method that is to be invoked as a super method.- Returns:
- The corresponding special method invocation which might be illegal if the requested invocation is not legal.
-
invokeSuper
Creates a special method invocation for the given node.- Parameters:
node
- The node for which a special method invocation is to be created.- Returns:
- A special method invocation for the provided node.
-
invokeSuper
private Implementation.SpecialMethodInvocation invokeSuper(MethodRebaseResolver.Resolution resolution) Creates a special method invocation for the given rebase resolution.- Parameters:
resolution
- The resolution for which a special method invocation is to be created.- Returns:
- A special method invocation for the provided resolution.
-
getOriginType
Identifies the origin type of an implementation. The origin type describes the type that is subject to any form of enhancement. If a subclass of a given type is generated, the base type of this subclass describes the origin type. If a given type is redefined or rebased, the origin type is described by the instrumented type itself.- Returns:
- The origin type of this implementation.
-