blob: e2354806b24dcfa443f1ae58672b2cc278084806 [file] [log] [blame]
Vinod Kumar Sc4216002016-03-03 19:55:30 +05301/*
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 S71cba682016-02-25 15:52:16 +053016
Vinod Kumar S71cba682016-02-25 15:52:16 +053017package org.onosproject.yangutils.datamodel;
18
19import org.onosproject.yangutils.datamodel.exceptions.DataModelException;
20import org.onosproject.yangutils.parser.Parsable;
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +053021import org.onosproject.yangutils.utils.YangConstructType;
Vinod Kumar S71cba682016-02-25 15:52:16 +053022
23/*-
Vinod Kumar Sc4216002016-03-03 19:55:30 +053024 * Reference RFC 6020.
25 *
Vinod Kumar S71cba682016-02-25 15:52:16 +053026 * 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 */
47public 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 Agrawal8e8770a2016-02-27 03:57:50 +053068 * @return effective YANG built-in type of the derived data type
Vinod Kumar S71cba682016-02-25 15:52:16 +053069 */
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 Agrawal8e8770a2016-02-27 03:57:50 +053077 * @param builtInType effective YANG built-in type of the derived data type
Vinod Kumar S71cba682016-02-25 15:52:16 +053078 */
79 public void setEffectiveYangBuiltInType(YangDataTypes builtInType) {
80 effectiveYangBuiltInType = builtInType;
81 }
82
83 /**
84 * Get the base type information.
85 *
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +053086 * @return base type information
Vinod Kumar S71cba682016-02-25 15:52:16 +053087 */
88 public YangType<?> getBaseType() {
89 return baseType;
90 }
91
92 /**
93 * Get the base type information.
94 *
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +053095 * @param baseType base type information
Vinod Kumar S71cba682016-02-25 15:52:16 +053096 */
97 public void setBaseType(YangType<?> baseType) {
98 this.baseType = baseType;
99 }
100
101 /**
102 * Get the parsable type.
103 */
104 @Override
Gaurav Agrawal8e8770a2016-02-27 03:57:50 +0530105 public YangConstructType getYangConstructType() {
106 return YangConstructType.DERIVED;
Vinod Kumar S71cba682016-02-25 15:52:16 +0530107 }
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}