blob: 794fb4cfd6d7ad45557a4351c2e9a862324c0d3b [file] [log] [blame]
Bharat saraswal870c56f2016-02-20 21:57:16 +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 */
16
17package org.onosproject.yangutils.translator.tojava;
18
Bharat saraswal870c56f2016-02-20 21:57:16 +053019import org.onosproject.yangutils.datamodel.YangType;
20
21/**
22 * Maintains the attribute info corresponding to class/interface generated.
23 */
Vinod Kumar Sc4216002016-03-03 19:55:30 +053024public class AttributeInfo {
Bharat saraswal870c56f2016-02-20 21:57:16 +053025
26 /**
27 * The data type info of attribute.
28 */
29 private YangType<?> attrType;
30
31 /**
32 * Name of the attribute.
33 */
34 private String name;
35
36 /**
37 * If the added attribute is a list of info.
38 */
Vinod Kumar Sc4216002016-03-03 19:55:30 +053039 private boolean isListAttr = false;
Bharat saraswal870c56f2016-02-20 21:57:16 +053040
41 /**
42 * If the added attribute has to be accessed in a fully qualified manner.
43 */
Bharat saraswal2f00b4b2016-03-04 20:08:09 +053044 private boolean isQualifiedName = false;
Bharat saraswal870c56f2016-02-20 21:57:16 +053045
46 /**
Vinod Kumar Sc4216002016-03-03 19:55:30 +053047 * The class info will be used to set the attribute type and package info
48 * will be use for qualified name.
49 */
50 private ImportInfo importInfo;
51
52 /**
Bharat saraswal870c56f2016-02-20 21:57:16 +053053 * Default constructor.
54 */
55 public AttributeInfo() {
56 }
57
58 /**
59 * Get the data type info of attribute.
60 *
Vinod Kumar Sc4216002016-03-03 19:55:30 +053061 * @return the data type info of attribute
Bharat saraswal870c56f2016-02-20 21:57:16 +053062 */
63 public YangType<?> getAttributeType() {
64 return attrType;
65 }
66
67 /**
68 * Set the data type info of attribute.
69 *
Vinod Kumar Sc4216002016-03-03 19:55:30 +053070 * @param type the data type info of attribute
Bharat saraswal870c56f2016-02-20 21:57:16 +053071 */
72 public void setAttributeType(YangType<?> type) {
Bharat saraswal4bf8b152016-02-25 02:26:43 +053073
Vinod Kumar Sc4216002016-03-03 19:55:30 +053074 attrType = type;
Bharat saraswal870c56f2016-02-20 21:57:16 +053075 }
76
77 /**
78 * Get name of the attribute.
79 *
Vinod Kumar Sc4216002016-03-03 19:55:30 +053080 * @return name of the attribute
Bharat saraswal870c56f2016-02-20 21:57:16 +053081 */
82 public String getAttributeName() {
83 return name;
84 }
85
86 /**
87 * Set name of the attribute.
88 *
Vinod Kumar Sc4216002016-03-03 19:55:30 +053089 * @param attrName name of the attribute
Bharat saraswal870c56f2016-02-20 21:57:16 +053090 */
91 public void setAttributeName(String attrName) {
92 name = attrName;
93 }
94
95 /**
96 * Get if the added attribute is a list of info.
97 *
Vinod Kumar Sc4216002016-03-03 19:55:30 +053098 * @return the if the added attribute is a list of info
Bharat saraswal870c56f2016-02-20 21:57:16 +053099 */
100 public boolean isListAttr() {
101 return isListAttr;
102 }
103
104 /**
105 * Set if the added attribute is a list of info.
106 *
Vinod Kumar Sc4216002016-03-03 19:55:30 +0530107 * @param isList if the added attribute is a list of info
Bharat saraswal870c56f2016-02-20 21:57:16 +0530108 */
109 public void setListAttr(boolean isList) {
110 isListAttr = isList;
111 }
112
113 /**
114 * Get if the added attribute has to be accessed in a fully qualified
115 * manner.
116 *
117 * @return the if the added attribute has to be accessed in a fully
118 * qualified manner.
119 */
120 public boolean isQualifiedName() {
121 return isQualifiedName;
122 }
123
124 /**
125 * Set if the added attribute has to be accessed in a fully qualified
126 * manner.
127 *
128 * @param isQualified if the added attribute has to be accessed in a fully
Vinod Kumar Sc4216002016-03-03 19:55:30 +0530129 * qualified manner
Bharat saraswal870c56f2016-02-20 21:57:16 +0530130 */
131 public void setQualifiedName(boolean isQualified) {
132 isQualifiedName = isQualified;
133 }
134
Vinod Kumar Sc4216002016-03-03 19:55:30 +0530135 /**
136 * Get the import info for the attribute type. It will be null, of the type
137 * is basic built-in java type.
138 *
139 * @return import info
140 */
141 public ImportInfo getImportInfo() {
142 return importInfo;
143 }
144
145 /**
146 * Set the import info for the attribute type.
147 *
148 * @param importInfo import info for the attribute type
149 */
150 public void setImportInfo(ImportInfo importInfo) {
151 this.importInfo = importInfo;
152 }
153
Bharat saraswal870c56f2016-02-20 21:57:16 +0530154}