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.equals(other.uuid))) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 7;
hash = 53 * hash + (this.uuid != null ? this.uuid.hashCode() : 0);
return hash;
}
}
मैं इस वर्ग को क्रमबद्ध और deserialize करने के लिए जीसन का उपयोग कर रहा हूँ। आज के रूप में मुझे इस वस्तु में एक अंतिम यूयूआईडी जोड़ना पड़ा। मुझे serializing कोई समस्या नहीं है। Deserializing जब मुझे public UserAction(UUID uuid)
कन्स्ट्रक्टर का उपयोग करने के लिए जीसन को मजबूर करने की आवश्यकता है। मैं उसे कैसे प्राप्त कर सकता हूं ?विशिष्ट निर्माता का उपयोग करने के लिए फोर्स जीएसओएन
मैं इसे बाहर की जाँच कर रहा हूँ अब, टिप के लिए धन्यवाद। – frail