PandaLib/pandalib-reflect/src/main/java/fr/pandacube/lib/reflect/MethodIdentifier.java

24 lines
660 B
Java
Raw Normal View History

2022-07-28 01:05:35 +02:00
package fr.pandacube.lib.reflect;
import java.util.Arrays;
import java.util.Objects;
/* package */ record MethodIdentifier(String methodName, Class<?>[] parameters) {
MethodIdentifier {
Objects.requireNonNull(methodName);
parameters = (parameters == null) ? new Class<?>[0] : parameters;
}
@Override
public boolean equals(Object other) {
return other instanceof MethodIdentifier o
&& o.methodName.equals(methodName)
&& Arrays.equals(o.parameters, parameters);
}
@Override
public int hashCode() {
return methodName.hashCode() ^ Arrays.hashCode(parameters);
}
}