1 package net.sf.snmpadaptor4j.core.mapping;
2
3 import java.io.Serializable;
4 import net.sf.snmpadaptor4j.object.SnmpDataType;
5 import net.sf.snmpadaptor4j.object.SnmpOid;
6
7
8
9
10
11 public final class MBeanAttributeMapping
12 implements Serializable {
13
14
15
16
17 private static final long serialVersionUID = 1031970528675491341L;
18
19
20
21
22 private final SnmpOid oid;
23
24
25
26
27 private final String attributeName;
28
29
30
31
32 private final SnmpDataType snmpDataType;
33
34
35
36
37 private final Class<?> jmxDataType;
38
39
40
41
42 private final boolean readable;
43
44
45
46
47 private final boolean writable;
48
49
50
51
52
53
54
55
56
57
58
59 MBeanAttributeMapping (final SnmpOid oid, final String attributeName, final SnmpDataType snmpDataType, final Class<?> jmxDataType, final boolean readable,
60 final boolean writable) {
61 super();
62 this.oid = oid;
63 this.attributeName = attributeName;
64 this.snmpDataType = snmpDataType;
65 this.jmxDataType = jmxDataType;
66 this.readable = readable;
67 this.writable = writable;
68 }
69
70
71
72
73
74 public SnmpOid getOid () {
75 return this.oid;
76 }
77
78
79
80
81
82 public String getAttributeName () {
83 return this.attributeName;
84 }
85
86
87
88
89
90 public SnmpDataType getSnmpDataType () {
91 return this.snmpDataType;
92 }
93
94
95
96
97
98 public Class<?> getJmxDataType () {
99 return this.jmxDataType;
100 }
101
102
103
104
105
106 public boolean isReadable () {
107 return this.readable;
108 }
109
110
111
112
113
114 public boolean isWritable () {
115 return this.writable;
116 }
117
118
119
120
121
122 @Override
123 public int hashCode () {
124 final int prime = 31;
125 int result = 1;
126 result = prime * result + ((this.attributeName == null) ? 0 : this.attributeName.hashCode());
127 result = prime * result + ((this.jmxDataType == null) ? 0 : this.jmxDataType.hashCode());
128 result = prime * result + ((this.oid == null) ? 0 : this.oid.hashCode());
129 result = prime * result + (this.readable ? 1231 : 1237);
130 result = prime * result + ((this.snmpDataType == null) ? 0 : this.snmpDataType.hashCode());
131 result = prime * result + (this.writable ? 1231 : 1237);
132 return result;
133 }
134
135
136
137
138
139 @Override
140 public boolean equals (final Object obj) {
141 boolean result = false;
142 if (obj == this) {
143 result = true;
144 }
145 else if ((obj != null) && (MBeanAttributeMapping.class.equals(obj.getClass()))) {
146 final MBeanAttributeMapping other = (MBeanAttributeMapping) obj;
147 result = (this.oid != null ? this.oid.equals(other.oid) : (other.oid == null));
148 if (result) {
149 result = (this.attributeName != null ? this.attributeName.equals(other.attributeName) : (other.attributeName == null));
150 }
151 if (result) {
152 result = (this.snmpDataType != null ? this.snmpDataType.equals(other.snmpDataType) : (other.snmpDataType == null));
153 }
154 if (result) {
155 result = (this.jmxDataType != null ? this.jmxDataType.equals(other.jmxDataType) : (other.jmxDataType == null));
156 }
157 if (result) {
158 result = (this.readable == other.readable);
159 }
160 if (result) {
161 result = (this.writable == other.writable);
162 }
163 }
164 return result;
165 }
166
167
168
169
170
171 @Override
172 public String toString () {
173 return "MBeanAttributeMapping[oid=" + this.oid + "; attributeName=" + this.attributeName + "; snmpDataType=" + this.snmpDataType + "; jmxDataType="
174 + this.jmxDataType + "; readable=" + this.readable + "; writable=" + this.writable + "]";
175 }
176
177 }