WebSocketCommunicationEvent.java 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Nextcloud Talk application
  3. *
  4. * @author Mario Danic
  5. * Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
  6. *
  7. * This program is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation, either version 3 of the License, or
  10. * at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. package com.nextcloud.talk.events;
  21. import java.util.HashMap;
  22. import androidx.annotation.Nullable;
  23. public class WebSocketCommunicationEvent {
  24. public final String type;
  25. @Nullable
  26. public final HashMap<String, String> hashMap;
  27. public WebSocketCommunicationEvent(String type, HashMap<String, String> hashMap) {
  28. this.type = type;
  29. this.hashMap = hashMap;
  30. }
  31. public String getType() {
  32. return this.type;
  33. }
  34. @Nullable
  35. public HashMap<String, String> getHashMap() {
  36. return this.hashMap;
  37. }
  38. public boolean equals(final Object o) {
  39. if (o == this) {
  40. return true;
  41. }
  42. if (!(o instanceof WebSocketCommunicationEvent)) {
  43. return false;
  44. }
  45. final WebSocketCommunicationEvent other = (WebSocketCommunicationEvent) o;
  46. if (!other.canEqual((Object) this)) {
  47. return false;
  48. }
  49. final Object this$type = this.getType();
  50. final Object other$type = other.getType();
  51. if (this$type == null ? other$type != null : !this$type.equals(other$type)) {
  52. return false;
  53. }
  54. final Object this$hashMap = this.getHashMap();
  55. final Object other$hashMap = other.getHashMap();
  56. return this$hashMap == null ? other$hashMap == null : this$hashMap.equals(other$hashMap);
  57. }
  58. protected boolean canEqual(final Object other) {
  59. return other instanceof WebSocketCommunicationEvent;
  60. }
  61. public int hashCode() {
  62. final int PRIME = 59;
  63. int result = 1;
  64. final Object $type = this.getType();
  65. result = result * PRIME + ($type == null ? 43 : $type.hashCode());
  66. final Object $hashMap = this.getHashMap();
  67. result = result * PRIME + ($hashMap == null ? 43 : $hashMap.hashCode());
  68. return result;
  69. }
  70. public String toString() {
  71. return "WebSocketCommunicationEvent(type=" + this.getType() + ", hashMap=" + this.getHashMap() + ")";
  72. }
  73. }