From fec6ba4dfe3a3033a3ca0a8c90262b44ffeb6d92 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Wed, 13 Nov 2024 22:26:06 +0100 Subject: [PATCH] Polishing --- .../org/springframework/util/unit/DataSize.java | 16 +++++++--------- .../org/springframework/util/unit/DataUnit.java | 3 ++- 2 files changed, 9 insertions(+), 10 deletions(-) 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 fa91266a44..33f76e9586 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.Assert; 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 final class DataSize implements Comparable, Serializable { @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 @@ public final class DataSize implements Comparable, Serializable { 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 8b5dc4354d..1d6df8c0f9 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 @@ public enum DataUnit { return this.size; } + /** * Return the {@link DataUnit} matching the specified {@code suffix}. * @param suffix one of the standard suffixes