mirror of
https://github.com/google/nomulus.git
synced 2025-07-01 00:33:34 +02:00
Don't override toString() on enums
It is a bad idea to override toString() on enums to return something other than the actual name of the enum. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=133318012
This commit is contained in:
parent
4a723576d5
commit
823bdc721f
1 changed files with 8 additions and 6 deletions
|
@ -133,8 +133,7 @@ public class RdapJsonFormatter {
|
|||
this.rfc7483String = rfc7483String;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
public String getDisplayName() {
|
||||
return rfc7483String;
|
||||
}
|
||||
}
|
||||
|
@ -211,8 +210,7 @@ public class RdapJsonFormatter {
|
|||
this.rfc7483String = rfc7483String;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
public String getDisplayName() {
|
||||
return rfc7483String;
|
||||
}
|
||||
}
|
||||
|
@ -821,7 +819,7 @@ public class RdapJsonFormatter {
|
|||
private static ImmutableMap<String, Object> makeEvent(
|
||||
RdapEventAction eventAction, @Nullable String eventActor, DateTime eventDate) {
|
||||
ImmutableMap.Builder<String, Object> builder = new ImmutableMap.Builder<>();
|
||||
builder.put("eventAction", eventAction.toString());
|
||||
builder.put("eventAction", eventAction.getDisplayName());
|
||||
if (eventActor != null) {
|
||||
builder.put("eventActor", eventActor);
|
||||
}
|
||||
|
@ -901,7 +899,11 @@ public class RdapJsonFormatter {
|
|||
return FluentIterable
|
||||
.from(statusValues)
|
||||
.transform(Functions.forMap(statusToRdapStatusMap, RdapStatus.OBSCURED))
|
||||
.transform(Functions.toStringFunction())
|
||||
.transform(new Function<RdapStatus, String>() {
|
||||
@Override
|
||||
public String apply(RdapStatus status) {
|
||||
return status.getDisplayName();
|
||||
}})
|
||||
.toSortedSet(Ordering.natural())
|
||||
.asList();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue