Enum ArgumentTypeResolver
- java.lang.Object
-
- java.lang.Enum<ArgumentTypeResolver>
-
- net.bytebuddy.implementation.bind.ArgumentTypeResolver
-
- All Implemented Interfaces:
Serializable
,Comparable<ArgumentTypeResolver>
,MethodDelegationBinder.AmbiguityResolver
public enum ArgumentTypeResolver extends Enum<ArgumentTypeResolver> implements MethodDelegationBinder.AmbiguityResolver
Implementation of anMethodDelegationBinder.AmbiguityResolver
that resolves two conflicting bindings by considering most-specific types of target method parameters in the same manner as the Java compiler resolves bindings of overloaded method.- Checks for each parameter of the source method if a one-to-one parameter binding to both of the target methods exist.
- If any of the source method parameters were bound one-to-one to both target methods, the method with the most specific type is considered as dominant.
- If this result is dominant for both the left and the right target method, this resolver will consider the binding as ambiguous.
- If none of the methods is dominant and if the comparison did not result in an ambiguous resolution, the method that consists of the most one-to-one parameter bindings is considered dominant.
foo(Object)
andbar(String)
, this ambiguity resolver will detect that theString
type is more specific than theObject
type and determinebar(String)
as the dominant binding.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ArgumentTypeResolver.ParameterIndexToken
This token is used to mark a one-to-one binding of a source method parameter to a target method parameter.protected static class
ArgumentTypeResolver.PrimitiveTypePrecedence
A representation of the precedence of a most specific primitive type in the Java programming language.-
Nested classes/interfaces inherited from interface net.bytebuddy.implementation.bind.MethodDelegationBinder.AmbiguityResolver
MethodDelegationBinder.AmbiguityResolver.Compound, MethodDelegationBinder.AmbiguityResolver.Directional, MethodDelegationBinder.AmbiguityResolver.NoOp, MethodDelegationBinder.AmbiguityResolver.Resolution
-
-
Enum Constant Summary
Enum Constants Enum Constant Description INSTANCE
The singleton instance.
-
Field Summary
-
Fields inherited from interface net.bytebuddy.implementation.bind.MethodDelegationBinder.AmbiguityResolver
DEFAULT
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MethodDelegationBinder.AmbiguityResolver.Resolution
resolve(MethodDescription source, MethodDelegationBinder.MethodBinding left, MethodDelegationBinder.MethodBinding right)
Attempts to resolve to conflicting bindings.static ArgumentTypeResolver
valueOf(String name)
Returns the enum constant of this type with the specified name.static ArgumentTypeResolver[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
INSTANCE
public static final ArgumentTypeResolver INSTANCE
The singleton instance.
-
-
Method Detail
-
values
public static ArgumentTypeResolver[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (ArgumentTypeResolver c : ArgumentTypeResolver.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ArgumentTypeResolver valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
resolve
public MethodDelegationBinder.AmbiguityResolver.Resolution resolve(MethodDescription source, MethodDelegationBinder.MethodBinding left, MethodDelegationBinder.MethodBinding right)
Attempts to resolve to conflicting bindings.- Specified by:
resolve
in interfaceMethodDelegationBinder.AmbiguityResolver
- Parameters:
source
- The source method that was bound to both target methods.left
- The first successful binding of thesource
method.right
- The second successful binding of thesource
method.- Returns:
- The resolution state when resolving a conflicting binding where
MethodDelegationBinder.AmbiguityResolver.Resolution.LEFT
indicates a successful binding to theleft
binding whileMethodDelegationBinder.AmbiguityResolver.Resolution.RIGHT
indicates a successful binding to theright
binding.
-
-