diff --git a/spring-core/src/main/java/org/springframework/util/unit/DataSize.java b/spring-core/src/main/java/org/springframework/util/unit/DataSize.java index fa91266a4442..33f76e9586ee 100644 --- a/spring-core/src/main/java/org/springframework/util/unit/DataSize.java +++ b/spring-core/src/main/java/org/springframework/util/unit/DataSize.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2023 the original author or authors. + * Copyright 2002-2024 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. @@ -25,9 +25,8 @@ import org.springframework.util.StringUtils; /** - * A data size, such as '12MB'. - * - *
This class models data size in terms of bytes and is immutable and thread-safe. + * A data size, such as '12MB'. This class models data size in terms of + * bytes and is immutable and thread-safe. * *
The terms and units used in this class are based on * binary prefixes @@ -247,14 +246,14 @@ public String toString() { @Override - public boolean equals(@Nullable Object obj) { - if (this == obj) { + public boolean equals(@Nullable Object other) { + if (this == other) { return true; } - if (obj == null || getClass() != obj.getClass()) { + if (other == null || getClass() != other.getClass()) { return false; } - DataSize that = (DataSize) obj; + DataSize that = (DataSize) other; return (this.bytes == that.bytes); } @@ -279,7 +278,6 @@ private static DataUnit determineDataUnit(String suffix, @Nullable DataUnit defa DataUnit defaultUnitToUse = (defaultUnit != null ? defaultUnit : DataUnit.BYTES); return (StringUtils.hasLength(suffix) ? DataUnit.fromSuffix(suffix) : defaultUnitToUse); } - } } diff --git a/spring-core/src/main/java/org/springframework/util/unit/DataUnit.java b/spring-core/src/main/java/org/springframework/util/unit/DataUnit.java index 8b5dc4354d85..1d6df8c0f949 100644 --- a/spring-core/src/main/java/org/springframework/util/unit/DataUnit.java +++ b/spring-core/src/main/java/org/springframework/util/unit/DataUnit.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2024 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. @@ -81,6 +81,7 @@ DataSize size() { return this.size; } + /** * Return the {@link DataUnit} matching the specified {@code suffix}. * @param suffix one of the standard suffixes