1 package net.sf.snmpadaptor4j.object;
2
3 import java.io.Serializable;
4
5
6
7
8
9 public final class SnmpTrapData
10 implements Serializable {
11
12
13
14
15 private static final long serialVersionUID = -8267283230287605599L;
16
17
18
19
20 private final SnmpDataType type;
21
22
23
24
25 private final Object value;
26
27
28
29
30
31
32 public SnmpTrapData (final SnmpDataType type, final Object value) {
33 super();
34 this.type = type;
35 this.value = value;
36 }
37
38
39
40
41
42 public SnmpDataType getType () {
43 return this.type;
44 }
45
46
47
48
49
50 public Object getValue () {
51 return this.value;
52 }
53
54
55
56
57
58 @Override
59 public int hashCode () {
60 final int prime = 31;
61 int result = 1;
62 result = prime * result + ((this.type == null) ? 0 : this.type.hashCode());
63 result = prime * result + ((this.value == null) ? 0 : this.value.hashCode());
64 return result;
65 }
66
67
68
69
70
71 @Override
72 public boolean equals (final Object obj) {
73 boolean result = false;
74 if (obj == this) {
75 result = true;
76 }
77 else if ((obj != null) && (obj.getClass() == getClass())) {
78 final SnmpTrapData other = (SnmpTrapData) obj;
79 if (other.type == this.type) {
80 result = (this.value != null ? this.value.equals(other.value) : (other.value == null));
81 }
82 }
83 return result;
84 }
85
86
87
88
89
90 @Override
91 public String toString () {
92 return "(" + this.type + ") " + this.value;
93 }
94
95 }