@HashCodeAndEqualsPlugin.Enhance public static class MethodDelegation.WithCustomProperties extends Object
MethodDelegation
with custom configuration.Modifier | Constructor and Description |
---|---|
protected |
WithCustomProperties(MethodDelegationBinder.AmbiguityResolver ambiguityResolver,
List<TargetMethodAnnotationDrivenBinder.ParameterBinder<?>> parameterBinders)
Creates a new method delegation with custom properties that does not filter any methods.
|
Modifier and Type | Method and Description |
---|---|
MethodDelegation.WithCustomProperties |
filter(ElementMatcher<? super MethodDescription> matcher)
Configures this method delegation to only consider methods or constructors as a delegation target if they match the supplied matcher.
|
MethodDelegation |
to(Class<?> type)
Delegates any intercepted method to invoke a
static method that is declared by the supplied type. |
MethodDelegation |
to(Object target)
Delegates any intercepted method to invoke a non-
static method that is declared by the supplied type's instance or any
of its super types. |
MethodDelegation |
to(Object target,
MethodGraph.Compiler methodGraphCompiler)
Delegates any intercepted method to invoke a non-
static method that is declared by the supplied type's instance or any
of its super types. |
MethodDelegation |
to(Object target,
String fieldName)
Delegates any intercepted method to invoke a non-
static method that is declared by the supplied type's instance or any
of its super types. |
MethodDelegation |
to(Object target,
String fieldName,
MethodGraph.Compiler methodGraphCompiler)
Delegates any intercepted method to invoke a non-
static method that is declared by the supplied type's instance or any
of its super types. |
MethodDelegation |
to(Object target,
Type type)
Delegates any intercepted method to invoke a non-
static method that is declared by the supplied type's instance or any
of its super types. |
MethodDelegation |
to(Object target,
TypeDefinition typeDefinition)
Delegates any intercepted method to invoke a non-
static method that is declared by the supplied type's instance or any
of its super types. |
MethodDelegation |
to(Object target,
TypeDefinition typeDefinition,
MethodGraph.Compiler methodGraphCompiler)
Delegates any intercepted method to invoke a non-
static method that is declared by the supplied type's instance or any
of its super types. |
MethodDelegation |
to(Object target,
TypeDefinition typeDefinition,
String fieldName)
Delegates any intercepted method to invoke a non-
static method that is declared by the supplied type's instance or any
of its super types. |
MethodDelegation |
to(Object target,
TypeDefinition typeDefinition,
String fieldName,
MethodGraph.Compiler methodGraphCompiler)
Delegates any intercepted method to invoke a non-
static method that is declared by the supplied type's instance or any
of its super types. |
MethodDelegation |
to(Object target,
Type type,
MethodGraph.Compiler methodGraphCompiler)
Delegates any intercepted method to invoke a non-
static method that is declared by the supplied type's instance or any
of its super types. |
MethodDelegation |
to(Object target,
Type type,
String fieldName)
Delegates any intercepted method to invoke a non-
static method that is declared by the supplied type's instance or any
of its super types. |
MethodDelegation |
to(Object target,
Type type,
String fieldName,
MethodGraph.Compiler methodGraphCompiler)
Delegates any intercepted method to invoke a non-
static method that is declared by the supplied type's instance or any
of its super types. |
MethodDelegation |
to(TypeDescription typeDescription)
Delegates any intercepted method to invoke a
static method that is declared by the supplied type. |
MethodDelegation |
toConstructor(Class<?> type)
Delegates any intercepted method to invoke a constructor of the supplied type.
|
MethodDelegation |
toConstructor(TypeDescription typeDescription)
Delegates any intercepted method to invoke a constructor of the supplied type.
|
MethodDelegation |
toField(String name)
Delegates any intercepted method to invoke a non-
static method on the instance of the supplied field. |
MethodDelegation |
toField(String name,
FieldLocator.Factory fieldLocatorFactory)
Delegates any intercepted method to invoke a non-
static method on the instance of the supplied field. |
MethodDelegation |
toField(String name,
FieldLocator.Factory fieldLocatorFactory,
MethodGraph.Compiler methodGraphCompiler)
Delegates any intercepted method to invoke a non-
static method on the instance of the supplied field. |
MethodDelegation |
toField(String name,
MethodGraph.Compiler methodGraphCompiler)
Delegates any intercepted method to invoke a non-
static method on the instance of the supplied field. |
MethodDelegation |
toMethodReturnOf(String name)
Delegates any intercepted method to invoke a method on an instance that is returned by a parameterless method of the
given name.
|
MethodDelegation |
toMethodReturnOf(String name,
MethodGraph.Compiler methodGraphCompiler)
Delegates any intercepted method to invoke a method on an instance that is returned by a parameterless method of the
given name.
|
MethodDelegation.WithCustomProperties |
withBinders(List<? extends TargetMethodAnnotationDrivenBinder.ParameterBinder<?>> parameterBinders)
Configures this method delegation to use the supplied parameter binders when deciding what value to assign to
a parameter of a delegation target.
|
MethodDelegation.WithCustomProperties |
withBinders(TargetMethodAnnotationDrivenBinder.ParameterBinder<?>... parameterBinder)
Configures this method delegation to use the supplied parameter binders when deciding what value to assign to
a parameter of a delegation target.
|
MethodDelegation.WithCustomProperties |
withBindingResolver(MethodDelegationBinder.BindingResolver bindingResolver)
Configures a custom binding resolver which is responsible for choosing a method binding among multiple candidates.
|
MethodDelegation.WithCustomProperties |
withResolvers(List<? extends MethodDelegationBinder.AmbiguityResolver> ambiguityResolvers)
Configures this method delegation to use the supplied ambiguity resolvers when deciding which out of two ore
more legal delegation targets should be considered.
|
MethodDelegation.WithCustomProperties |
withResolvers(MethodDelegationBinder.AmbiguityResolver... ambiguityResolver)
Configures this method delegation to use the supplied ambiguity resolvers when deciding which out of two ore
more legal delegation targets should be considered.
|
protected WithCustomProperties(MethodDelegationBinder.AmbiguityResolver ambiguityResolver, List<TargetMethodAnnotationDrivenBinder.ParameterBinder<?>> parameterBinders)
ambiguityResolver
- The ambiguity resolver to use.parameterBinders
- The parameter binders to use.public MethodDelegation.WithCustomProperties withResolvers(MethodDelegationBinder.AmbiguityResolver... ambiguityResolver)
ambiguityResolver
- The ambiguity resolvers to use in their application order.public MethodDelegation.WithCustomProperties withResolvers(List<? extends MethodDelegationBinder.AmbiguityResolver> ambiguityResolvers)
ambiguityResolvers
- The ambiguity resolvers to use in their application order.public MethodDelegation.WithCustomProperties withBinders(TargetMethodAnnotationDrivenBinder.ParameterBinder<?>... parameterBinder)
parameterBinder
- The parameter binders to use.public MethodDelegation.WithCustomProperties withBinders(List<? extends TargetMethodAnnotationDrivenBinder.ParameterBinder<?>> parameterBinders)
parameterBinders
- The parameter binders to use.public MethodDelegation.WithCustomProperties withBindingResolver(MethodDelegationBinder.BindingResolver bindingResolver)
bindingResolver
- The binding resolver being used to select the relevant method binding.public MethodDelegation.WithCustomProperties filter(ElementMatcher<? super MethodDescription> matcher)
matcher
- The matcher any delegation target needs to match in order to be considered a for delegation.public MethodDelegation to(Class<?> type)
static
method that is declared by the supplied type. To be considered
a valid delegation target, the target method must be visible and accessible to the instrumented type. This is the case if
the target type is either public or in the same package as the instrumented type and if the target method is either public
or non-private and in the same package as the instrumented type. Private methods can only be used as a delegation target if
the interception is targeting the instrumented type.type
- The target type for the delegation.public MethodDelegation to(TypeDescription typeDescription)
static
method that is declared by the supplied type. To be considered
a valid delegation target, the target method must be visible and accessible to the instrumented type. This is the case if
the target type is either public or in the same package as the instrumented type and if the target method is either public
or non-private and in the same package as the instrumented type. Private methods can only be used as a delegation target if
the delegation is targeting the instrumented type.typeDescription
- The target type for the delegation.public MethodDelegation to(Object target)
static
method that is declared by the supplied type's instance or any
of its super types. To be considered a valid delegation target, a method must be visible and accessible to the instrumented type.
This is the case if the method's declaring type is either public or in the same package as the instrumented type and if the method
is either public or non-private and in the same package as the instrumented type. Private methods can only be used as
a delegation target if the delegation is targeting the instrumented type.target
- The target instance for the delegation.public MethodDelegation to(Object target, MethodGraph.Compiler methodGraphCompiler)
static
method that is declared by the supplied type's instance or any
of its super types. To be considered a valid delegation target, a method must be visible and accessible to the instrumented type.
This is the case if the method's declaring type is either public or in the same package as the instrumented type and if the method
is either public or non-private and in the same package as the instrumented type. Private methods can only be used as
a delegation target if the delegation is targeting the instrumented type.target
- The target instance for the delegation.methodGraphCompiler
- The method graph compiler to use.public MethodDelegation to(Object target, String fieldName)
static
method that is declared by the supplied type's instance or any
of its super types. To be considered a valid delegation target, a method must be visible and accessible to the instrumented type.
This is the case if the method's declaring type is either public or in the same package as the instrumented type and if the method
is either public or non-private and in the same package as the instrumented type. Private methods can only be used as
a delegation target if the delegation is targeting the instrumented type.target
- The target instance for the delegation.fieldName
- The name of the field that is holding the target
instance.public MethodDelegation to(Object target, String fieldName, MethodGraph.Compiler methodGraphCompiler)
static
method that is declared by the supplied type's instance or any
of its super types. To be considered a valid delegation target, a method must be visible and accessible to the instrumented type.
This is the case if the method's declaring type is either public or in the same package as the instrumented type and if the method
is either public or non-private and in the same package as the instrumented type. Private methods can only be used as
a delegation target if the delegation is targeting the instrumented type.target
- The target instance for the delegation.fieldName
- The name of the field that is holding the target
instance.methodGraphCompiler
- The method graph compiler to use.public MethodDelegation to(Object target, Type type)
static
method that is declared by the supplied type's instance or any
of its super types. To be considered a valid delegation target, a method must be visible and accessible to the instrumented type.
This is the case if the method's declaring type is either public or in the same package as the instrumented type and if the method
is either public or non-private and in the same package as the instrumented type. Private methods can only be used as
a delegation target if the delegation is targeting the instrumented type.target
- The target instance for the delegation.type
- The most specific type of which target
should be considered. Must be a super type of the target's actual type.public MethodDelegation to(Object target, Type type, MethodGraph.Compiler methodGraphCompiler)
static
method that is declared by the supplied type's instance or any
of its super types. To be considered a valid delegation target, a method must be visible and accessible to the instrumented type.
This is the case if the method's declaring type is either public or in the same package as the instrumented type and if the method
is either public or non-private and in the same package as the instrumented type. Private methods can only be used as
a delegation target if the delegation is targeting the instrumented type.target
- The target instance for the delegation.type
- The most specific type of which target
should be considered. Must be a super type of the target's actual type.methodGraphCompiler
- The method graph compiler to use.public MethodDelegation to(Object target, Type type, String fieldName)
static
method that is declared by the supplied type's instance or any
of its super types. To be considered a valid delegation target, a method must be visible and accessible to the instrumented type.
This is the case if the method's declaring type is either public or in the same package as the instrumented type and if the method
is either public or non-private and in the same package as the instrumented type. Private methods can only be used as
a delegation target if the delegation is targeting the instrumented type.target
- The target instance for the delegation.type
- The most specific type of which target
should be considered. Must be a super type of the target's actual type.fieldName
- The name of the field that is holding the target
instance.public MethodDelegation to(Object target, Type type, String fieldName, MethodGraph.Compiler methodGraphCompiler)
static
method that is declared by the supplied type's instance or any
of its super types. To be considered a valid delegation target, a method must be visible and accessible to the instrumented type.
This is the case if the method's declaring type is either public or in the same package as the instrumented type and if the method
is either public or non-private and in the same package as the instrumented type. Private methods can only be used as
a delegation target if the delegation is targeting the instrumented type.target
- The target instance for the delegation.type
- The most specific type of which target
should be considered. Must be a super type of the target's actual type.fieldName
- The name of the field that is holding the target
instance.methodGraphCompiler
- The method graph compiler to use.public MethodDelegation to(Object target, TypeDefinition typeDefinition)
static
method that is declared by the supplied type's instance or any
of its super types. To be considered a valid delegation target, a method must be visible and accessible to the instrumented type.
This is the case if the method's declaring type is either public or in the same package as the instrumented type and if the method
is either public or non-private and in the same package as the instrumented type. Private methods can only be used as
a delegation target if the delegation is targeting the instrumented type.target
- The target instance for the delegation.typeDefinition
- The most specific type of which target
should be considered. Must be a super type of the target's actual type.public MethodDelegation to(Object target, TypeDefinition typeDefinition, MethodGraph.Compiler methodGraphCompiler)
static
method that is declared by the supplied type's instance or any
of its super types. To be considered a valid delegation target, a method must be visible and accessible to the instrumented type.
This is the case if the method's declaring type is either public or in the same package as the instrumented type and if the method
is either public or non-private and in the same package as the instrumented type. Private methods can only be used as
a delegation target if the delegation is targeting the instrumented type.target
- The target instance for the delegation.typeDefinition
- The most specific type of which target
should be considered. Must be a super type of the target's actual type.methodGraphCompiler
- The method graph compiler to use.public MethodDelegation to(Object target, TypeDefinition typeDefinition, String fieldName)
static
method that is declared by the supplied type's instance or any
of its super types. To be considered a valid delegation target, a method must be visible and accessible to the instrumented type.
This is the case if the method's declaring type is either public or in the same package as the instrumented type and if the method
is either public or non-private and in the same package as the instrumented type. Private methods can only be used as
a delegation target if the delegation is targeting the instrumented type.target
- The target instance for the delegation.typeDefinition
- The most specific type of which target
should be considered. Must be a super type of the target's actual type.fieldName
- The name of the field that is holding the target
instance.public MethodDelegation to(Object target, TypeDefinition typeDefinition, String fieldName, MethodGraph.Compiler methodGraphCompiler)
static
method that is declared by the supplied type's instance or any
of its super types. To be considered a valid delegation target, a method must be visible and accessible to the instrumented type.
This is the case if the method's declaring type is either public or in the same package as the instrumented type and if the method
is either public or non-private and in the same package as the instrumented type. Private methods can only be used as
a delegation target if the delegation is targeting the instrumented type.target
- The target instance for the delegation.typeDefinition
- The most specific type of which target
should be considered. Must be a super type of the target's actual type.fieldName
- The name of the field that is holding the target
instance.methodGraphCompiler
- The method graph compiler to use.public MethodDelegation toConstructor(Class<?> type)
type
- The type to construct.public MethodDelegation toConstructor(TypeDescription typeDescription)
typeDescription
- The type to construct.public MethodDelegation toField(String name)
static
method on the instance of the supplied field. To be
considered a valid delegation target, a method must be visible and accessible to the instrumented type. This is the
case if the method's declaring type is either public or in the same package as the instrumented type and if the method
is either public or non-private and in the same package as the instrumented type. Private methods can only be used as
a delegation target if the delegation is targeting the instrumented type.name
- The field's name.public MethodDelegation toField(String name, FieldLocator.Factory fieldLocatorFactory)
static
method on the instance of the supplied field. To be
considered a valid delegation target, a method must be visible and accessible to the instrumented type. This is the
case if the method's declaring type is either public or in the same package as the instrumented type and if the method
is either public or non-private and in the same package as the instrumented type. Private methods can only be used as
a delegation target if the delegation is targeting the instrumented type.name
- The field's name.fieldLocatorFactory
- The field locator factory to use.public MethodDelegation toField(String name, MethodGraph.Compiler methodGraphCompiler)
static
method on the instance of the supplied field. To be
considered a valid delegation target, a method must be visible and accessible to the instrumented type. This is the
case if the method's declaring type is either public or in the same package as the instrumented type and if the method
is either public or non-private and in the same package as the instrumented type. Private methods can only be used as
a delegation target if the delegation is targeting the instrumented type.name
- The field's name.methodGraphCompiler
- The method graph compiler to use.public MethodDelegation toField(String name, FieldLocator.Factory fieldLocatorFactory, MethodGraph.Compiler methodGraphCompiler)
static
method on the instance of the supplied field. To be
considered a valid delegation target, a method must be visible and accessible to the instrumented type. This is the
case if the method's declaring type is either public or in the same package as the instrumented type and if the method
is either public or non-private and in the same package as the instrumented type. Private methods can only be used as
a delegation target if the delegation is targeting the instrumented type.name
- The field's name.fieldLocatorFactory
- The field locator factory to use.methodGraphCompiler
- The method graph compiler to use.public MethodDelegation toMethodReturnOf(String name)
name
- The name of the method that returns the delegation target.public MethodDelegation toMethodReturnOf(String name, MethodGraph.Compiler methodGraphCompiler)
name
- The name of the method that returns the delegation target.methodGraphCompiler
- The method graph compiler to use.Copyright © 2014–2025. All rights reserved.