blob: 03414c0ac3c9dd16baa99301e46405e3a2d42d61 [file] [log] [blame]
Vinod Kumar S38046502016-03-23 15:30:27 +05301/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2016-present Open Networking Laboratory
Vinod Kumar S38046502016-03-23 15:30:27 +05303 *
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 saraswal33dfa012016-05-17 19:59:16 +053019import org.onosproject.yangutils.translator.tojava.utils.YangPluginConfig;
20
Vinod Kumar S38046502016-03-23 15:30:27 +053021/**
Bharat saraswald9822e92016-04-05 15:13:44 +053022 * Represents cached java file handle, which supports the addition of member attributes and
Vinod Kumar S38046502016-03-23 15:30:27 +053023 * methods.
24 */
25public class JavaFileInfo {
Bharat saraswal6ef0b762016-04-05 12:45:45 +053026
Vinod Kumar S38046502016-03-23 15:30:27 +053027 /**
28 * The type(s) of java source file(s) to be generated when the cached file
29 * handle is closed.
30 */
31 private int genFileTypes;
32
33 /**
34 * Name of the module.
35 */
36 private String javaName;
37
38 /**
Bharat saraswalcc1cdab2016-04-16 02:28:25 +053039 * Java Package of the mapped java class.
Vinod Kumar S38046502016-03-23 15:30:27 +053040 */
41 private String pkg;
42
43 /**
44 * File generation directory path.
45 */
46 private String relativeFilePath;
47
48 /**
49 * File generation base directory path.
50 */
51 private String codeGenDirFilePath;
52
53 /**
Bharat saraswal33dfa012016-05-17 19:59:16 +053054 * Plugin configuration for naming convention.
55 */
56 private YangPluginConfig pluginConfig;
57
58 /**
Bharat saraswald9822e92016-04-05 15:13:44 +053059 * Returns the types of files being generated corresponding to the YANG
Vinod Kumar S38046502016-03-23 15:30:27 +053060 * definition.
61 *
62 * @return the types of files being generated corresponding to the YANG
VinodKumarS-Huaweicb3a1f52016-05-10 17:58:57 +053063 * definition
Vinod Kumar S38046502016-03-23 15:30:27 +053064 */
65 public int getGeneratedFileTypes() {
66 return genFileTypes;
67 }
68
69 /**
Bharat saraswald9822e92016-04-05 15:13:44 +053070 * Sets the types of files being generated corresponding to the YANG
Vinod Kumar S38046502016-03-23 15:30:27 +053071 * definition.
72 *
73 * @param fileTypes the types of files being generated corresponding to the
VinodKumarS-Huaweicb3a1f52016-05-10 17:58:57 +053074 * YANG definition
Vinod Kumar S38046502016-03-23 15:30:27 +053075 */
76 public void setGeneratedFileTypes(int fileTypes) {
77 genFileTypes = fileTypes;
78 }
79
80 /**
VinodKumarS-Huaweicb3a1f52016-05-10 17:58:57 +053081 * Adds the types of files being generated corresponding to the YANG
82 * definition.
83 *
84 * @param fileTypes the types of files being generated corresponding to the
85 * YANG definition
86 */
87 public void addGeneratedFileTypes(int fileTypes) {
88 genFileTypes |= fileTypes;
89 }
90
91 /**
Bharat saraswald9822e92016-04-05 15:13:44 +053092 * Returns the java name of the node.
Vinod Kumar S38046502016-03-23 15:30:27 +053093 *
94 * @return the java name of node
95 */
96 public String getJavaName() {
97 return javaName;
98 }
99
100 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530101 * Sets the java name of the node.
Vinod Kumar S38046502016-03-23 15:30:27 +0530102 *
103 * @param name the java name of node
104 */
105 public void setJavaName(String name) {
106 javaName = name;
107 }
108
109 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530110 * Returns the mapped java package.
Vinod Kumar S38046502016-03-23 15:30:27 +0530111 *
112 * @return the java package
113 */
114 public String getPackage() {
Vinod Kumar S38046502016-03-23 15:30:27 +0530115 return pkg;
116 }
117
118 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530119 * Sets the node's package.
Vinod Kumar S38046502016-03-23 15:30:27 +0530120 *
121 * @param nodePackage node's package
122 */
123 public void setPackage(String nodePackage) {
124 pkg = nodePackage;
125 }
126
127 /**
128 * Sets directory package path for code generation.
129 *
130 * @param path directory package path for code generation
131 */
132 public void setPackageFilePath(String path) {
133 relativeFilePath = path;
134 }
135
136 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530137 * Returns directory package path for code generation.
Vinod Kumar S38046502016-03-23 15:30:27 +0530138 *
139 * @return directory package path for code generation
140 */
141 public String getPackageFilePath() {
142 return relativeFilePath;
143 }
144
145 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530146 * Returns base directory package path for code generation.
Vinod Kumar S38046502016-03-23 15:30:27 +0530147 *
148 * @return directory package path for code generation
149 */
150 public String getBaseCodeGenPath() {
151 return codeGenDirFilePath;
152 }
153
154 /**
155 * Sets base directory package path for code generation.
156 *
157 * @param path base directory path
158 */
159 public void setBaseCodeGenPath(String path) {
160 codeGenDirFilePath = path;
161 }
Bharat saraswal33dfa012016-05-17 19:59:16 +0530162
163 /**
164 * Returns plugin configurations.
165 *
166 * @return the pluginConfig
167 */
168 public YangPluginConfig getPluginConfig() {
169 return pluginConfig;
170 }
171
172 /**
173 * Sets plugin configurations.
174 *
175 * @param pluginConfig the pluginConfig to set
176 */
177 public void setPluginConfig(YangPluginConfig pluginConfig) {
178 this.pluginConfig = pluginConfig;
179 }
Vinod Kumar S38046502016-03-23 15:30:27 +0530180}