Guest User

Untitled

a guest
Nov 19th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. public class AirEventInput {
  2.  
  3. private Long id;
  4. private String eventName;
  5. private Long startDate;
  6. private Long endDate;
  7.  
  8. public Long getId() {
  9. return id;
  10. }
  11.  
  12. public void setId(Long id) {
  13. this.id = id;
  14. }
  15.  
  16. public String getEventName() {
  17. return eventName;
  18. }
  19.  
  20. public void setEventName(String eventName) {
  21. this.eventName = eventName;
  22. }
  23.  
  24. public Long getStartDate() {
  25. return startDate;
  26. }
  27.  
  28. public void setStartDate(Long startDate) {
  29. this.startDate = startDate;
  30. }
  31.  
  32. public Long getEndDate() {
  33. return endDate;
  34. }
  35.  
  36. public void setEndDate(Long endDate) {
  37. this.endDate = endDate;
  38. }
  39.  
  40. public class AirEventAPI {
  41.  
  42. private Long id;
  43. private String eventName;
  44. private Long startDate;
  45. private Long endDate;
  46.  
  47. public Long getId() {
  48. return id;
  49. }
  50.  
  51. public void setId(Long id) {
  52. this.id = id;
  53. }
  54.  
  55. public String getEventName() {
  56. return eventName;
  57. }
  58.  
  59. public void setEventName(String eventName) {
  60. this.eventName = eventName;
  61. }
  62.  
  63. public Long getStartDate() {
  64. return startDate;
  65. }
  66.  
  67. public void setStartDate(Long startDate) {
  68. this.startDate = startDate;
  69. }
  70.  
  71. public Long getEndDate() {
  72. return endDate;
  73. }
  74.  
  75. public void setEndDate(Long endDate) {
  76. this.endDate = endDate;
  77. }
  78.  
  79. public EventAPI mergeTwoEvents(EventInput eventInput, EventAPI eventAPI){
  80. ModelMapper modelMapper = new ModelMapper();
  81. modelMapper.createTypeMap(EventInput.class, EventAPI.class)
  82. .addMappings((mapper) -> mapper.skip(AirEventAPI::setStartDate));
  83. .setCondition(Conditions.isNotNull());
  84.  
  85.  
  86. modelMapper.map(eventInput, eventAPI);
  87.  
  88. return eventAPI;
  89. }
Add Comment
Please, Sign In to add comment