net.bytebuddy.implementation.bind.ParameterLengthResolver Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of byte-buddy-dep Show documentation
Show all versions of byte-buddy-dep Show documentation
Byte Buddy is a Java library for creating Java classes at run time.
This artifact is a build of Byte Buddy with a remaining dependency onto ASM.
You should never depend on this module without repackaging Byte Buddy and ASM into your own namespace.
package net.bytebuddy.implementation.bind;
import net.bytebuddy.description.method.MethodDescription;
/**
* This {@link net.bytebuddy.implementation.bind.MethodDelegationBinder.AmbiguityResolver} selects
* the method with more arguments. If two methods have equally many arguments, the resolution is ambiguous.
*/
public enum ParameterLengthResolver implements MethodDelegationBinder.AmbiguityResolver {
/**
* The singleton instance.
*/
INSTANCE;
@Override
public Resolution resolve(MethodDescription source,
MethodDelegationBinder.MethodBinding left,
MethodDelegationBinder.MethodBinding right) {
int leftLength = left.getTarget().getParameters().size();
int rightLength = right.getTarget().getParameters().size();
if (leftLength == rightLength) {
return Resolution.AMBIGUOUS;
} else if (leftLength < rightLength) {
return Resolution.RIGHT;
} else {
return Resolution.LEFT;
}
}
@Override
public String toString() {
return "ParameterLengthResolver." + name();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy