13b28559db6512228189b3240157c6a9425f0bbd
[lispflowmapping.git] / mappingservice / lisp-proto / src / main / java / org / opendaylight / lispflowmapping / lisp / util / NumberUtil.java
1 /*
2  * Copyright (c) 2014 Contextream, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.lispflowmapping.lisp.util;
9
10 public final class NumberUtil {
11     // Utility class, should not be instantiated
12     private NumberUtil() {
13     }
14
15     public static int asInt(Integer number) {
16         if (number != null) {
17             return number;
18         }
19         return 0;
20     }
21
22     public static byte asByte(Byte number) {
23         if (number != null) {
24             return number;
25         }
26         return 0;
27     }
28
29     public static short asShort(Short number) {
30         if (number != null) {
31             return number;
32         }
33         return 0;
34     }
35
36     public static long asLong(Long number) {
37         if (number != null) {
38             return number;
39         }
40         return 0;
41     }
42
43 }