private MethodIdentifier(final Method method) { returnType = method.getReturnType().getName(); final String name = (this.name = method.getName()); final Class<?>[] methodParameterTypes = method.getParameterTypes(); final String[] parameterTypes = methodParameterTypes.length == 0 ? NO_STRINGS : namesOf(methodParameterTypes); hashCode = calculateHash(returnType, name, parameterTypes); this.parameterTypes = parameterTypes; }
/** * Construct a new instance using class objects for the parameter types. * * @param returnType the method return type * @param name the method name * @param parameterTypes the method parameter types * @return the identifier */ public static MethodIdentifier getIdentifier(final Class<?> returnType, final String name, final Class<?>... parameterTypes) { return new MethodIdentifier(returnType.getName(), name, namesOf(parameterTypes)); }