重写 toString 方法。

feature/net-util
ZhouXY108 2022-12-15 11:43:24 +08:00
parent 2e1ee521f7
commit 3f4343c996
1 changed files with 7 additions and 0 deletions

View File

@ -35,4 +35,11 @@ public abstract class Enumeration<T extends Enumeration<T>> {
Enumeration<?> other = (Enumeration<?>) obj; Enumeration<?> other = (Enumeration<?>) obj;
return value == other.value; return value == other.value;
} }
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("[").append(value).append(": ").append(name).append("]");
return builder.toString();
}
} }