Force GSON to use specific constructor
问题 public class UserAction { private final UUID uuid; private String userId; /* more fields, setters and getters here */ public UserAction(){ this.uuid = UUID.fromString(new com.eaio.uuid.UUID().toString()); } public UserAction(UUID uuid){ this.uuid = uuid; } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final UserAction other = (UserAction) obj; if (this.uuid != other.uuid && (this.uuid == null || !this.uuid