Guest User

Untitled

a guest
Jan 22nd, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. {
  2. "metadata": {
  3. "eventName": "FooEvent",
  4. "field1": "bla"
  5. },
  6. "event": { ... }
  7. }
  8.  
  9. @JsonTypeInfo(
  10. use = Id.NAME,
  11. include = As.EXISTING_PROPERTY,
  12. visible = true,
  13. property = "metadata.eventName"
  14. )
  15. @JsonSubTypes.Type(name="fooEvent", value = FooEvent.class)
  16. @JsonSubTypes.Type(name="barEvent", value = BarEvent.class)
  17. public class EventPayload<T> {
  18. private Metadata metadata;
  19. private T event;
  20. }
  21.  
  22. com.fasterxml.jackson.databind.JsonMappingException: Unexpected token (END_OBJECT), expected FIELD_NAME: missing property 'metadata.eventName' that is to contain type id (for class EventPayload)
  23. at [Source: {
  24. "metadata": {
  25. "eventName": "FooEvent",
  26. "field1": "bla"
  27. },
  28. "content": { ... }
  29. }; line: 16, column: 1]
Add Comment
Please, Sign In to add comment