重写 toString 方法。
parent
2e1ee521f7
commit
3f4343c996
|
@ -35,4 +35,11 @@ public abstract class Enumeration<T extends Enumeration<T>> {
|
|||
Enumeration<?> other = (Enumeration<?>) obj;
|
||||
return value == other.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("[").append(value).append(": ").append(name).append("]");
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue