Vinod Kumar S | 48848f7 | 2016-02-25 15:52:16 +0530 | [diff] [blame] | 1 | /*Copyright 2016.year Open Networking Laboratory |
| 2 | |
| 3 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | you may not use this file except in compliance with the License. |
| 5 | You may obtain a copy of the License at |
| 6 | |
| 7 | http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | |
| 9 | Unless required by applicable law or agreed to in writing, software |
| 10 | distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | See the License for the specific language governing permissions and |
| 13 | limitations under the License.*/ |
| 14 | package org.onosproject.yangutils.datamodel; |
| 15 | |
| 16 | import org.onosproject.yangutils.datamodel.exceptions.DataModelException; |
| 17 | import org.onosproject.yangutils.parser.Parsable; |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame^] | 18 | import org.onosproject.yangutils.utils.YangConstructType; |
Vinod Kumar S | 48848f7 | 2016-02-25 15:52:16 +0530 | [diff] [blame] | 19 | |
| 20 | /*- |
| 21 | * The typedef Statement |
| 22 | * |
| 23 | * The "typedef" statement defines a new type that may be used locally |
| 24 | * in the module, in modules or submodules which include it, and by |
| 25 | * other modules that import from it. The new type is called the |
| 26 | * "derived type", and the type from which it was derived is called |
| 27 | * the "base type". All derived types can be traced back to a YANG |
| 28 | * built-in type. |
| 29 | * |
| 30 | * The "typedef" statement's argument is an identifier that is the name |
| 31 | * of the type to be defined, and MUST be followed by a block of |
| 32 | * sub-statements that holds detailed typedef information. |
| 33 | * |
| 34 | * The name of the type MUST NOT be one of the YANG built-in types. If |
| 35 | * the typedef is defined at the top level of a YANG module or |
| 36 | * submodule, the name of the type to be defined MUST be unique within |
| 37 | * the module. |
| 38 | */ |
| 39 | /** |
| 40 | * Derived type information. |
| 41 | */ |
| 42 | public class YangDerivedType implements Parsable { |
| 43 | |
| 44 | /** |
| 45 | * All derived types can be traced back to a YANG built-in type. |
| 46 | */ |
| 47 | private YangDataTypes effectiveYangBuiltInType; |
| 48 | |
| 49 | /** |
| 50 | * Base type from which the current type is derived. |
| 51 | */ |
| 52 | private YangType<?> baseType; |
| 53 | |
| 54 | /** |
| 55 | * Default constructor. |
| 56 | */ |
| 57 | public YangDerivedType() { |
| 58 | } |
| 59 | |
| 60 | /** |
| 61 | * Get the effective YANG built-in type of the derived data type. |
| 62 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame^] | 63 | * @return effective YANG built-in type of the derived data type |
Vinod Kumar S | 48848f7 | 2016-02-25 15:52:16 +0530 | [diff] [blame] | 64 | */ |
| 65 | public YangDataTypes getEffectiveYangBuiltInType() { |
| 66 | return effectiveYangBuiltInType; |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * Set the effective YANG built-in type of the derived data type. |
| 71 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame^] | 72 | * @param builtInType effective YANG built-in type of the derived data type |
Vinod Kumar S | 48848f7 | 2016-02-25 15:52:16 +0530 | [diff] [blame] | 73 | */ |
| 74 | public void setEffectiveYangBuiltInType(YangDataTypes builtInType) { |
| 75 | effectiveYangBuiltInType = builtInType; |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * Get the base type information. |
| 80 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame^] | 81 | * @return base type information |
Vinod Kumar S | 48848f7 | 2016-02-25 15:52:16 +0530 | [diff] [blame] | 82 | */ |
| 83 | public YangType<?> getBaseType() { |
| 84 | return baseType; |
| 85 | } |
| 86 | |
| 87 | /** |
| 88 | * Get the base type information. |
| 89 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame^] | 90 | * @param baseType base type information |
Vinod Kumar S | 48848f7 | 2016-02-25 15:52:16 +0530 | [diff] [blame] | 91 | */ |
| 92 | public void setBaseType(YangType<?> baseType) { |
| 93 | this.baseType = baseType; |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * Get the parsable type. |
| 98 | */ |
| 99 | @Override |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame^] | 100 | public YangConstructType getYangConstructType() { |
| 101 | return YangConstructType.DERIVED; |
Vinod Kumar S | 48848f7 | 2016-02-25 15:52:16 +0530 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | /** |
| 105 | * TODO. |
| 106 | */ |
| 107 | @Override |
| 108 | public void validateDataOnEntry() throws DataModelException { |
| 109 | // TODO Auto-generated method stub |
| 110 | |
| 111 | } |
| 112 | |
| 113 | /** |
| 114 | * TODO. |
| 115 | */ |
| 116 | @Override |
| 117 | public void validateDataOnExit() throws DataModelException { |
| 118 | // TODO Auto-generated method stub |
| 119 | |
| 120 | } |
| 121 | |
| 122 | } |