Vinod Kumar S | 0871098 | 2016-03-03 19:55:30 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016 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 | */ |
Vinod Kumar S | 48848f7 | 2016-02-25 15:52:16 +0530 | [diff] [blame] | 16 | |
Vinod Kumar S | 48848f7 | 2016-02-25 15:52:16 +0530 | [diff] [blame] | 17 | package org.onosproject.yangutils.datamodel; |
| 18 | |
| 19 | import org.onosproject.yangutils.datamodel.exceptions.DataModelException; |
| 20 | import org.onosproject.yangutils.parser.Parsable; |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 21 | import org.onosproject.yangutils.utils.YangConstructType; |
Vinod Kumar S | 48848f7 | 2016-02-25 15:52:16 +0530 | [diff] [blame] | 22 | |
| 23 | /*- |
Vinod Kumar S | 0871098 | 2016-03-03 19:55:30 +0530 | [diff] [blame] | 24 | * Reference RFC 6020. |
| 25 | * |
Vinod Kumar S | 48848f7 | 2016-02-25 15:52:16 +0530 | [diff] [blame] | 26 | * The typedef Statement |
| 27 | * |
| 28 | * The "typedef" statement defines a new type that may be used locally |
| 29 | * in the module, in modules or submodules which include it, and by |
| 30 | * other modules that import from it. The new type is called the |
| 31 | * "derived type", and the type from which it was derived is called |
| 32 | * the "base type". All derived types can be traced back to a YANG |
| 33 | * built-in type. |
| 34 | * |
| 35 | * The "typedef" statement's argument is an identifier that is the name |
| 36 | * of the type to be defined, and MUST be followed by a block of |
| 37 | * sub-statements that holds detailed typedef information. |
| 38 | * |
| 39 | * The name of the type MUST NOT be one of the YANG built-in types. If |
| 40 | * the typedef is defined at the top level of a YANG module or |
| 41 | * submodule, the name of the type to be defined MUST be unique within |
| 42 | * the module. |
| 43 | */ |
| 44 | /** |
| 45 | * Derived type information. |
| 46 | */ |
| 47 | public class YangDerivedType implements Parsable { |
| 48 | |
| 49 | /** |
| 50 | * All derived types can be traced back to a YANG built-in type. |
| 51 | */ |
| 52 | private YangDataTypes effectiveYangBuiltInType; |
| 53 | |
| 54 | /** |
| 55 | * Base type from which the current type is derived. |
| 56 | */ |
| 57 | private YangType<?> baseType; |
| 58 | |
| 59 | /** |
| 60 | * Default constructor. |
| 61 | */ |
| 62 | public YangDerivedType() { |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Get the effective YANG built-in type of the derived data type. |
| 67 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 68 | * @return effective YANG built-in type of the derived data type |
Vinod Kumar S | 48848f7 | 2016-02-25 15:52:16 +0530 | [diff] [blame] | 69 | */ |
| 70 | public YangDataTypes getEffectiveYangBuiltInType() { |
| 71 | return effectiveYangBuiltInType; |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * Set the effective YANG built-in type of the derived data type. |
| 76 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 77 | * @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] | 78 | */ |
| 79 | public void setEffectiveYangBuiltInType(YangDataTypes builtInType) { |
| 80 | effectiveYangBuiltInType = builtInType; |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * Get the base type information. |
| 85 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 86 | * @return base type information |
Vinod Kumar S | 48848f7 | 2016-02-25 15:52:16 +0530 | [diff] [blame] | 87 | */ |
| 88 | public YangType<?> getBaseType() { |
| 89 | return baseType; |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 | * Get the base type information. |
| 94 | * |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 95 | * @param baseType base type information |
Vinod Kumar S | 48848f7 | 2016-02-25 15:52:16 +0530 | [diff] [blame] | 96 | */ |
| 97 | public void setBaseType(YangType<?> baseType) { |
| 98 | this.baseType = baseType; |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * Get the parsable type. |
| 103 | */ |
| 104 | @Override |
Gaurav Agrawal | db828bd | 2016-02-27 03:57:50 +0530 | [diff] [blame] | 105 | public YangConstructType getYangConstructType() { |
| 106 | return YangConstructType.DERIVED; |
Vinod Kumar S | 48848f7 | 2016-02-25 15:52:16 +0530 | [diff] [blame] | 107 | } |
| 108 | |
| 109 | /** |
| 110 | * TODO. |
| 111 | */ |
| 112 | @Override |
| 113 | public void validateDataOnEntry() throws DataModelException { |
| 114 | // TODO Auto-generated method stub |
| 115 | |
| 116 | } |
| 117 | |
| 118 | /** |
| 119 | * TODO. |
| 120 | */ |
| 121 | @Override |
| 122 | public void validateDataOnExit() throws DataModelException { |
| 123 | // TODO Auto-generated method stub |
| 124 | |
| 125 | } |
| 126 | |
| 127 | } |