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; }
private MethodIdentifier(final String returnType, final String name, final String... parameterTypes) { if (returnType == null) { throw new IllegalArgumentException("returnType is null"); } if (name == null) { throw new IllegalArgumentException("name is null"); } if (parameterTypes == null) { throw new IllegalArgumentException("parameterTypes is null"); } this.returnType = returnType; this.name = name; this.parameterTypes = parameterTypes == null || parameterTypes.length == 0 ? NO_STRINGS : parameterTypes.clone(); hashCode = calculateHash(returnType, name, parameterTypes); }