Polishing

This commit is contained in:
Juergen Hoeller
2023-07-26 14:02:05 +02:00
parent 23eb0e3128
commit 14c8c9168c
8 changed files with 54 additions and 64 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,6 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.TreeMap;
@@ -373,6 +372,7 @@ abstract class NamedParameterUtils {
private final int endIndex;
ParameterHolder(String parameterName, int startIndex, int endIndex) {
Assert.notNull(parameterName, "Parameter name must not be null");
this.parameterName = parameterName;
this.startIndex = startIndex;
this.endIndex = endIndex;
@@ -391,21 +391,21 @@ abstract class NamedParameterUtils {
}
@Override
public boolean equals(Object o) {
if (this == o) {
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (!(o instanceof ParameterHolder)) {
if (!(other instanceof ParameterHolder)) {
return false;
}
ParameterHolder that = (ParameterHolder) o;
return this.startIndex == that.startIndex && this.endIndex == that.endIndex
&& Objects.equals(this.parameterName, that.parameterName);
ParameterHolder that = (ParameterHolder) other;
return (this.startIndex == that.startIndex && this.endIndex == that.endIndex &&
this.parameterName.equals(that.parameterName));
}
@Override
public int hashCode() {
return Objects.hash(this.parameterName, this.startIndex, this.endIndex);
return this.parameterName.hashCode();
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2020 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,8 +16,6 @@
package org.springframework.r2dbc.core;
import java.util.Objects;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
@@ -109,21 +107,21 @@ public final class Parameter {
@Override
public boolean equals(Object obj) {
if (this == obj) {
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (!(obj instanceof Parameter)) {
if (!(other instanceof Parameter)) {
return false;
}
Parameter other = (Parameter) obj;
return (ObjectUtils.nullSafeEquals(this.value, other.value) &&
ObjectUtils.nullSafeEquals(this.type, other.type));
Parameter that = (Parameter) other;
return (ObjectUtils.nullSafeEquals(this.value, that.value) &&
ObjectUtils.nullSafeEquals(this.type, that.type));
}
@Override
public int hashCode() {
return Objects.hash(this.value, this.type);
return ObjectUtils.nullSafeHashCode(this.value) + ObjectUtils.nullSafeHashCode(this.type);
}
@Override