Gaurav Agrawal | 72cd1b7 | 2016-06-30 13:28:14 +0530 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2016-present Open Networking Laboratory |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package org.onosproject.yangutils.datamodel.utils.builtindatatype; |
| 18 | |
| 19 | import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.DECIMAL64; |
| 20 | import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT16; |
| 21 | import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT32; |
| 22 | import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT64; |
| 23 | import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.INT8; |
| 24 | import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.UINT16; |
| 25 | import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.UINT32; |
| 26 | import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.UINT64; |
| 27 | import static org.onosproject.yangutils.datamodel.utils.builtindatatype.YangDataTypes.UINT8; |
| 28 | |
| 29 | /** |
| 30 | * Represents YANG data type utilities. |
| 31 | */ |
| 32 | public final class YangDataTypeUtils { |
| 33 | |
| 34 | /** |
| 35 | * Restricts creation of YANG data type utils instance. |
| 36 | */ |
| 37 | private YangDataTypeUtils() { |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Returns whether the data type is of range restricted type. |
| 42 | * |
| 43 | * @param dataType data type to be checked |
| 44 | * @return true, if data type can have range restrictions, false otherwise |
| 45 | */ |
| 46 | public static boolean isOfRangeRestrictedType(YangDataTypes dataType) { |
| 47 | return dataType == INT8 |
| 48 | || dataType == INT16 |
| 49 | || dataType == INT32 |
| 50 | || dataType == INT64 |
| 51 | || dataType == UINT8 |
| 52 | || dataType == UINT16 |
| 53 | || dataType == UINT32 |
| 54 | || dataType == UINT64 |
| 55 | || dataType == DECIMAL64; |
| 56 | } |
| 57 | } |