Sho SHIMIZU
Committed by Gerrit Code Review

Avoid object creation and NullPointerException on unboxing

Change-Id: I9b372e7fcf6fb286834fabad60714fe58188b269
...@@ -141,7 +141,7 @@ public final class DefaultTrafficSelector implements TrafficSelector { ...@@ -141,7 +141,7 @@ public final class DefaultTrafficSelector implements TrafficSelector {
141 } 141 }
142 142
143 @Override 143 @Override
144 - public Builder matchMetadata(Long metadata) { 144 + public Builder matchMetadata(long metadata) {
145 return add(Criteria.matchMetadata(metadata)); 145 return add(Criteria.matchMetadata(metadata));
146 } 146 }
147 147
...@@ -156,7 +156,7 @@ public final class DefaultTrafficSelector implements TrafficSelector { ...@@ -156,7 +156,7 @@ public final class DefaultTrafficSelector implements TrafficSelector {
156 } 156 }
157 157
158 @Override 158 @Override
159 - public Builder matchEthType(Short ethType) { 159 + public Builder matchEthType(short ethType) {
160 return add(Criteria.matchEthType(ethType)); 160 return add(Criteria.matchEthType(ethType));
161 } 161 }
162 162
...@@ -166,22 +166,22 @@ public final class DefaultTrafficSelector implements TrafficSelector { ...@@ -166,22 +166,22 @@ public final class DefaultTrafficSelector implements TrafficSelector {
166 } 166 }
167 167
168 @Override 168 @Override
169 - public Builder matchVlanPcp(Byte vlanPcp) { 169 + public Builder matchVlanPcp(byte vlanPcp) {
170 return add(Criteria.matchVlanPcp(vlanPcp)); 170 return add(Criteria.matchVlanPcp(vlanPcp));
171 } 171 }
172 172
173 @Override 173 @Override
174 - public Builder matchIPDscp(Byte ipDscp) { 174 + public Builder matchIPDscp(byte ipDscp) {
175 return add(Criteria.matchIPDscp(ipDscp)); 175 return add(Criteria.matchIPDscp(ipDscp));
176 } 176 }
177 177
178 @Override 178 @Override
179 - public Builder matchIPEcn(Byte ipEcn) { 179 + public Builder matchIPEcn(byte ipEcn) {
180 return add(Criteria.matchIPEcn(ipEcn)); 180 return add(Criteria.matchIPEcn(ipEcn));
181 } 181 }
182 182
183 @Override 183 @Override
184 - public Builder matchIPProtocol(Byte proto) { 184 + public Builder matchIPProtocol(byte proto) {
185 return add(Criteria.matchIPProtocol(proto)); 185 return add(Criteria.matchIPProtocol(proto));
186 } 186 }
187 187
...@@ -196,42 +196,42 @@ public final class DefaultTrafficSelector implements TrafficSelector { ...@@ -196,42 +196,42 @@ public final class DefaultTrafficSelector implements TrafficSelector {
196 } 196 }
197 197
198 @Override 198 @Override
199 - public Builder matchTcpSrc(Short tcpPort) { 199 + public Builder matchTcpSrc(short tcpPort) {
200 return add(Criteria.matchTcpSrc(tcpPort)); 200 return add(Criteria.matchTcpSrc(tcpPort));
201 } 201 }
202 202
203 @Override 203 @Override
204 - public Builder matchTcpDst(Short tcpPort) { 204 + public Builder matchTcpDst(short tcpPort) {
205 return add(Criteria.matchTcpDst(tcpPort)); 205 return add(Criteria.matchTcpDst(tcpPort));
206 } 206 }
207 207
208 @Override 208 @Override
209 - public Builder matchUdpSrc(Short udpPort) { 209 + public Builder matchUdpSrc(short udpPort) {
210 return add(Criteria.matchUdpSrc(udpPort)); 210 return add(Criteria.matchUdpSrc(udpPort));
211 } 211 }
212 212
213 @Override 213 @Override
214 - public Builder matchUdpDst(Short udpPort) { 214 + public Builder matchUdpDst(short udpPort) {
215 return add(Criteria.matchUdpDst(udpPort)); 215 return add(Criteria.matchUdpDst(udpPort));
216 } 216 }
217 217
218 @Override 218 @Override
219 - public Builder matchSctpSrc(Short sctpPort) { 219 + public Builder matchSctpSrc(short sctpPort) {
220 return add(Criteria.matchSctpSrc(sctpPort)); 220 return add(Criteria.matchSctpSrc(sctpPort));
221 } 221 }
222 222
223 @Override 223 @Override
224 - public Builder matchSctpDst(Short sctpPort) { 224 + public Builder matchSctpDst(short sctpPort) {
225 return add(Criteria.matchSctpDst(sctpPort)); 225 return add(Criteria.matchSctpDst(sctpPort));
226 } 226 }
227 227
228 @Override 228 @Override
229 - public Builder matchIcmpType(Byte icmpType) { 229 + public Builder matchIcmpType(byte icmpType) {
230 return add(Criteria.matchIcmpType(icmpType)); 230 return add(Criteria.matchIcmpType(icmpType));
231 } 231 }
232 232
233 @Override 233 @Override
234 - public Builder matchIcmpCode(Byte icmpCode) { 234 + public Builder matchIcmpCode(byte icmpCode) {
235 return add(Criteria.matchIcmpCode(icmpCode)); 235 return add(Criteria.matchIcmpCode(icmpCode));
236 } 236 }
237 237
...@@ -246,17 +246,17 @@ public final class DefaultTrafficSelector implements TrafficSelector { ...@@ -246,17 +246,17 @@ public final class DefaultTrafficSelector implements TrafficSelector {
246 } 246 }
247 247
248 @Override 248 @Override
249 - public Builder matchIPv6FlowLabel(Integer flowLabel) { 249 + public Builder matchIPv6FlowLabel(int flowLabel) {
250 return add(Criteria.matchIPv6FlowLabel(flowLabel)); 250 return add(Criteria.matchIPv6FlowLabel(flowLabel));
251 } 251 }
252 252
253 @Override 253 @Override
254 - public Builder matchIcmpv6Type(Byte icmpv6Type) { 254 + public Builder matchIcmpv6Type(byte icmpv6Type) {
255 return add(Criteria.matchIcmpv6Type(icmpv6Type)); 255 return add(Criteria.matchIcmpv6Type(icmpv6Type));
256 } 256 }
257 257
258 @Override 258 @Override
259 - public Builder matchIcmpv6Code(Byte icmpv6Code) { 259 + public Builder matchIcmpv6Code(byte icmpv6Code) {
260 return add(Criteria.matchIcmpv6Code(icmpv6Code)); 260 return add(Criteria.matchIcmpv6Code(icmpv6Code));
261 } 261 }
262 262
...@@ -281,17 +281,17 @@ public final class DefaultTrafficSelector implements TrafficSelector { ...@@ -281,17 +281,17 @@ public final class DefaultTrafficSelector implements TrafficSelector {
281 } 281 }
282 282
283 @Override 283 @Override
284 - public Builder matchIPv6ExthdrFlags(Integer exthdrFlags) { 284 + public Builder matchIPv6ExthdrFlags(int exthdrFlags) {
285 return add(Criteria.matchIPv6ExthdrFlags(exthdrFlags)); 285 return add(Criteria.matchIPv6ExthdrFlags(exthdrFlags));
286 } 286 }
287 287
288 @Override 288 @Override
289 - public Builder matchLambda(Short lambda) { 289 + public Builder matchLambda(short lambda) {
290 return add(Criteria.matchLambda(lambda)); 290 return add(Criteria.matchLambda(lambda));
291 } 291 }
292 292
293 @Override 293 @Override
294 - public Builder matchOpticalSignalType(Short signalType) { 294 + public Builder matchOpticalSignalType(short signalType) {
295 return add(Criteria.matchOpticalSignalType(signalType)); 295 return add(Criteria.matchOpticalSignalType(signalType));
296 } 296 }
297 297
......
...@@ -82,7 +82,7 @@ public interface TrafficSelector { ...@@ -82,7 +82,7 @@ public interface TrafficSelector {
82 * @param metadata the metadata 82 * @param metadata the metadata
83 * @return a selection builder 83 * @return a selection builder
84 */ 84 */
85 - public Builder matchMetadata(Long metadata); 85 + public Builder matchMetadata(long metadata);
86 86
87 /** 87 /**
88 * Matches a l2 dst address. 88 * Matches a l2 dst address.
...@@ -106,7 +106,7 @@ public interface TrafficSelector { ...@@ -106,7 +106,7 @@ public interface TrafficSelector {
106 * @param ethType an ethernet type 106 * @param ethType an ethernet type
107 * @return a selection builder 107 * @return a selection builder
108 */ 108 */
109 - public Builder matchEthType(Short ethType); 109 + public Builder matchEthType(short ethType);
110 110
111 /** 111 /**
112 * Matches the vlan id. 112 * Matches the vlan id.
...@@ -122,7 +122,7 @@ public interface TrafficSelector { ...@@ -122,7 +122,7 @@ public interface TrafficSelector {
122 * @param vlanPcp a vlan priority 122 * @param vlanPcp a vlan priority
123 * @return a selection builder 123 * @return a selection builder
124 */ 124 */
125 - public Builder matchVlanPcp(Byte vlanPcp); 125 + public Builder matchVlanPcp(byte vlanPcp);
126 126
127 /** 127 /**
128 * Matches an IP DSCP (6 bits in ToS field). 128 * Matches an IP DSCP (6 bits in ToS field).
...@@ -130,7 +130,7 @@ public interface TrafficSelector { ...@@ -130,7 +130,7 @@ public interface TrafficSelector {
130 * @param ipDscp an IP DSCP value 130 * @param ipDscp an IP DSCP value
131 * @return a selection builder 131 * @return a selection builder
132 */ 132 */
133 - public Builder matchIPDscp(Byte ipDscp); 133 + public Builder matchIPDscp(byte ipDscp);
134 134
135 /** 135 /**
136 * Matches an IP ECN (2 bits in ToS field). 136 * Matches an IP ECN (2 bits in ToS field).
...@@ -138,7 +138,7 @@ public interface TrafficSelector { ...@@ -138,7 +138,7 @@ public interface TrafficSelector {
138 * @param ipEcn an IP ECN value 138 * @param ipEcn an IP ECN value
139 * @return a selection builder 139 * @return a selection builder
140 */ 140 */
141 - public Builder matchIPEcn(Byte ipEcn); 141 + public Builder matchIPEcn(byte ipEcn);
142 142
143 /** 143 /**
144 * Matches the l3 protocol. 144 * Matches the l3 protocol.
...@@ -146,7 +146,7 @@ public interface TrafficSelector { ...@@ -146,7 +146,7 @@ public interface TrafficSelector {
146 * @param proto a l3 protocol 146 * @param proto a l3 protocol
147 * @return a selection builder 147 * @return a selection builder
148 */ 148 */
149 - public Builder matchIPProtocol(Byte proto); 149 + public Builder matchIPProtocol(byte proto);
150 150
151 /** 151 /**
152 * Matches a l3 IPv4 address. 152 * Matches a l3 IPv4 address.
...@@ -170,7 +170,7 @@ public interface TrafficSelector { ...@@ -170,7 +170,7 @@ public interface TrafficSelector {
170 * @param tcpPort a TCP source port number 170 * @param tcpPort a TCP source port number
171 * @return a selection builder 171 * @return a selection builder
172 */ 172 */
173 - public Builder matchTcpSrc(Short tcpPort); 173 + public Builder matchTcpSrc(short tcpPort);
174 174
175 /** 175 /**
176 * Matches a TCP destination port number. 176 * Matches a TCP destination port number.
...@@ -178,7 +178,7 @@ public interface TrafficSelector { ...@@ -178,7 +178,7 @@ public interface TrafficSelector {
178 * @param tcpPort a TCP destination port number 178 * @param tcpPort a TCP destination port number
179 * @return a selection builder 179 * @return a selection builder
180 */ 180 */
181 - public Builder matchTcpDst(Short tcpPort); 181 + public Builder matchTcpDst(short tcpPort);
182 182
183 /** 183 /**
184 * Matches an UDP source port number. 184 * Matches an UDP source port number.
...@@ -186,7 +186,7 @@ public interface TrafficSelector { ...@@ -186,7 +186,7 @@ public interface TrafficSelector {
186 * @param udpPort an UDP source port number 186 * @param udpPort an UDP source port number
187 * @return a selection builder 187 * @return a selection builder
188 */ 188 */
189 - public Builder matchUdpSrc(Short udpPort); 189 + public Builder matchUdpSrc(short udpPort);
190 190
191 /** 191 /**
192 * Matches an UDP destination port number. 192 * Matches an UDP destination port number.
...@@ -194,7 +194,7 @@ public interface TrafficSelector { ...@@ -194,7 +194,7 @@ public interface TrafficSelector {
194 * @param udpPort an UDP destination port number 194 * @param udpPort an UDP destination port number
195 * @return a selection builder 195 * @return a selection builder
196 */ 196 */
197 - public Builder matchUdpDst(Short udpPort); 197 + public Builder matchUdpDst(short udpPort);
198 198
199 /** 199 /**
200 * Matches a SCTP source port number. 200 * Matches a SCTP source port number.
...@@ -202,7 +202,7 @@ public interface TrafficSelector { ...@@ -202,7 +202,7 @@ public interface TrafficSelector {
202 * @param sctpPort a SCTP source port number 202 * @param sctpPort a SCTP source port number
203 * @return a selection builder 203 * @return a selection builder
204 */ 204 */
205 - public Builder matchSctpSrc(Short sctpPort); 205 + public Builder matchSctpSrc(short sctpPort);
206 206
207 /** 207 /**
208 * Matches a SCTP destination port number. 208 * Matches a SCTP destination port number.
...@@ -210,7 +210,7 @@ public interface TrafficSelector { ...@@ -210,7 +210,7 @@ public interface TrafficSelector {
210 * @param sctpPort a SCTP destination port number 210 * @param sctpPort a SCTP destination port number
211 * @return a selection builder 211 * @return a selection builder
212 */ 212 */
213 - public Builder matchSctpDst(Short sctpPort); 213 + public Builder matchSctpDst(short sctpPort);
214 214
215 /** 215 /**
216 * Matches an ICMP type. 216 * Matches an ICMP type.
...@@ -218,7 +218,7 @@ public interface TrafficSelector { ...@@ -218,7 +218,7 @@ public interface TrafficSelector {
218 * @param icmpType an ICMP type 218 * @param icmpType an ICMP type
219 * @return a selection builder 219 * @return a selection builder
220 */ 220 */
221 - public Builder matchIcmpType(Byte icmpType); 221 + public Builder matchIcmpType(byte icmpType);
222 222
223 /** 223 /**
224 * Matches an ICMP code. 224 * Matches an ICMP code.
...@@ -226,7 +226,7 @@ public interface TrafficSelector { ...@@ -226,7 +226,7 @@ public interface TrafficSelector {
226 * @param icmpCode an ICMP code 226 * @param icmpCode an ICMP code
227 * @return a selection builder 227 * @return a selection builder
228 */ 228 */
229 - public Builder matchIcmpCode(Byte icmpCode); 229 + public Builder matchIcmpCode(byte icmpCode);
230 230
231 /** 231 /**
232 * Matches a l3 IPv6 address. 232 * Matches a l3 IPv6 address.
...@@ -250,7 +250,7 @@ public interface TrafficSelector { ...@@ -250,7 +250,7 @@ public interface TrafficSelector {
250 * @param flowLabel an IPv6 flow label 250 * @param flowLabel an IPv6 flow label
251 * @return a selection builder 251 * @return a selection builder
252 */ 252 */
253 - public Builder matchIPv6FlowLabel(Integer flowLabel); 253 + public Builder matchIPv6FlowLabel(int flowLabel);
254 254
255 /** 255 /**
256 * Matches an ICMPv6 type. 256 * Matches an ICMPv6 type.
...@@ -258,7 +258,7 @@ public interface TrafficSelector { ...@@ -258,7 +258,7 @@ public interface TrafficSelector {
258 * @param icmpv6Type an ICMPv6 type 258 * @param icmpv6Type an ICMPv6 type
259 * @return a selection builder 259 * @return a selection builder
260 */ 260 */
261 - public Builder matchIcmpv6Type(Byte icmpv6Type); 261 + public Builder matchIcmpv6Type(byte icmpv6Type);
262 262
263 /** 263 /**
264 * Matches an ICMPv6 code. 264 * Matches an ICMPv6 code.
...@@ -266,7 +266,7 @@ public interface TrafficSelector { ...@@ -266,7 +266,7 @@ public interface TrafficSelector {
266 * @param icmpv6Code an ICMPv6 code 266 * @param icmpv6Code an ICMPv6 code
267 * @return a selection builder 267 * @return a selection builder
268 */ 268 */
269 - public Builder matchIcmpv6Code(Byte icmpv6Code); 269 + public Builder matchIcmpv6Code(byte icmpv6Code);
270 270
271 /** 271 /**
272 * Matches an IPv6 Neighbor Discovery target address. 272 * Matches an IPv6 Neighbor Discovery target address.
...@@ -306,7 +306,7 @@ public interface TrafficSelector { ...@@ -306,7 +306,7 @@ public interface TrafficSelector {
306 * @param exthdrFlags the IPv6 Extension Header pseudo-field fiags 306 * @param exthdrFlags the IPv6 Extension Header pseudo-field fiags
307 * @return a selection builder 307 * @return a selection builder
308 */ 308 */
309 - public Builder matchIPv6ExthdrFlags(Integer exthdrFlags); 309 + public Builder matchIPv6ExthdrFlags(int exthdrFlags);
310 310
311 /** 311 /**
312 * Matches an optical signal ID or lambda. 312 * Matches an optical signal ID or lambda.
...@@ -314,7 +314,7 @@ public interface TrafficSelector { ...@@ -314,7 +314,7 @@ public interface TrafficSelector {
314 * @param lambda lamda 314 * @param lambda lamda
315 * @return a selection builder 315 * @return a selection builder
316 */ 316 */
317 - public Builder matchLambda(Short lambda); 317 + public Builder matchLambda(short lambda);
318 318
319 /** 319 /**
320 * Matches an optical Signal Type. 320 * Matches an optical Signal Type.
...@@ -322,7 +322,7 @@ public interface TrafficSelector { ...@@ -322,7 +322,7 @@ public interface TrafficSelector {
322 * @param signalType signalType 322 * @param signalType signalType
323 * @return a selection builder 323 * @return a selection builder
324 */ 324 */
325 - public Builder matchOpticalSignalType(Short signalType); 325 + public Builder matchOpticalSignalType(short signalType);
326 326
327 /** 327 /**
328 * Builds an immutable traffic selector. 328 * Builds an immutable traffic selector.
......