Guest User

Untitled

a guest
Jan 16th, 2018
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. @JsonProperty(value="Contact")
  2. @NotNull(message = "ContactUser or CompanyName is required.")
  3. @Valid
  4. @XmlElements(value = {
  5. @XmlElement(name = "ContactUser", type = ContactUser.class, required = true),
  6. @XmlElement(name = "CompanyName", type = String.class, required = true) })
  7. private Object contactInfo;
  8.  
  9. "Contact":{
  10. "ContactUser":{
  11. "Title": "Miss",
  12. "LastName": "Hello"
  13. }
  14. }
  15.  
  16. "Contact": "Hello Company"
  17.  
  18. "ContactUser":{
  19. "Title": "Miss",
  20. "LastName": "Hello"
  21. }
  22.  
  23. "CompanyName": "Hello Company"
  24.  
  25. <CompanyName>Hello Company</CompanyName>
  26.  
  27. <ContactUser>
  28. <Title>Miss</Title>
  29. <LastName>Hello</LastName>
  30. </ContactUser>
  31.  
  32. @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include =JsonTypeInfo.As.WRAPPER_OBJECT, visible=true)
  33. @JsonSubTypes({
  34. @JsonSubTypes.Type(name = "ContactUserJ", value = ContactUser.class),
  35. @JsonSubTypes.Type(name = "CompanyNameJ" , value = String.class)
  36. })
Add Comment
Please, Sign In to add comment