Guest User

Untitled

a guest
Jan 24th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. public class Response implements Serializable {
  2.  
  3. @SerializedName("message")
  4. @Expose
  5. private List<Message> messages;
  6.  
  7. public List<Message> getMessages() {
  8. return messages;
  9. }
  10.  
  11. public void setMessages(List<Message> messages) {
  12. this.messages = messages;
  13. }
  14.  
  15. }
  16.  
  17. public class Message implements Serializable {
  18.  
  19. @SerializedName("type")
  20. @Expose
  21. @MessageType
  22. private int type;
  23.  
  24. @SerializedName("position")
  25. @Expose
  26. @MessagePosition
  27. private String position;
  28.  
  29. public int getType() {
  30. return type;
  31. }
  32.  
  33. public String getPosition() {
  34. return position;
  35. }
  36.  
  37. public void setType(@MessageType int type) {
  38. this.type = type;
  39. }
  40.  
  41. public void setPosition(@MessagePosition String position) {
  42. this.position = position;
  43. }
  44.  
  45. }
  46.  
  47. public class TextMessage extends Message {
  48.  
  49. @SerializedName("text")
  50. @Expose
  51. private String text;
  52.  
  53. public String getText() {
  54. return text;
  55. }
  56.  
  57. public void setText(String text) {
  58. this.text = text;
  59. }
  60.  
  61. public class ImageMessage extends Message {
  62.  
  63. @SerializedName("attachment")
  64. @Expose
  65. private Attachment attachment;
  66.  
  67. public Attachment getAttachment() {
  68. return attachment;
  69. }
  70.  
  71. public void setAttachment(Attachment attachment) {
  72. this.attachment = attachment;
  73. }
  74.  
  75. }
  76.  
  77. ---- Response
  78. |
  79. - TextResponse -> List<TextMessage>
  80. |
  81. - ImageResponse -> List<ImageMessage>
Add Comment
Please, Sign In to add comment