blob: 1c37e06f82a7ebde6deb03cd8e3a9a12bdd5d548 [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 saraswal96dfef02016-06-16 00:29:12 +053019import java.io.Serializable;
20
Gaurav Agrawal8a5af142016-06-15 13:58:01 +053021import org.onosproject.yangutils.utils.io.impl.YangPluginConfig;
Bharat saraswal33dfa012016-05-17 19:59:16 +053022
Vinod Kumar S38046502016-03-23 15:30:27 +053023/**
Bharat saraswald9822e92016-04-05 15:13:44 +053024 * Represents cached java file handle, which supports the addition of member attributes and
Vinod Kumar S38046502016-03-23 15:30:27 +053025 * methods.
26 */
Bharat saraswal96dfef02016-06-16 00:29:12 +053027public class JavaFileInfo implements Serializable {
28
29 private static final long serialVersionUID = 806102633L;
Bharat saraswal6ef0b762016-04-05 12:45:45 +053030
Vinod Kumar S38046502016-03-23 15:30:27 +053031 /**
32 * The type(s) of java source file(s) to be generated when the cached file
33 * handle is closed.
34 */
Bharat saraswal96dfef02016-06-16 00:29:12 +053035 private transient int genFileTypes;
Vinod Kumar S38046502016-03-23 15:30:27 +053036
37 /**
38 * Name of the module.
39 */
40 private String javaName;
41
42 /**
Bharat saraswalcc1cdab2016-04-16 02:28:25 +053043 * Java Package of the mapped java class.
Vinod Kumar S38046502016-03-23 15:30:27 +053044 */
45 private String pkg;
46
47 /**
48 * File generation directory path.
49 */
50 private String relativeFilePath;
51
52 /**
53 * File generation base directory path.
54 */
55 private String codeGenDirFilePath;
56
57 /**
Bharat saraswal33dfa012016-05-17 19:59:16 +053058 * Plugin configuration for naming convention.
59 */
Bharat saraswal96dfef02016-06-16 00:29:12 +053060 private transient YangPluginConfig pluginConfig;
Bharat saraswal33dfa012016-05-17 19:59:16 +053061
62 /**
Bharat saraswald9822e92016-04-05 15:13:44 +053063 * Returns the types of files being generated corresponding to the YANG
Vinod Kumar S38046502016-03-23 15:30:27 +053064 * definition.
65 *
66 * @return the types of files being generated corresponding to the YANG
VinodKumarS-Huaweicb3a1f52016-05-10 17:58:57 +053067 * definition
Vinod Kumar S38046502016-03-23 15:30:27 +053068 */
69 public int getGeneratedFileTypes() {
70 return genFileTypes;
71 }
72
73 /**
Bharat saraswald9822e92016-04-05 15:13:44 +053074 * Sets the types of files being generated corresponding to the YANG
Vinod Kumar S38046502016-03-23 15:30:27 +053075 * definition.
76 *
77 * @param fileTypes the types of files being generated corresponding to the
VinodKumarS-Huaweicb3a1f52016-05-10 17:58:57 +053078 * YANG definition
Vinod Kumar S38046502016-03-23 15:30:27 +053079 */
80 public void setGeneratedFileTypes(int fileTypes) {
81 genFileTypes = fileTypes;
82 }
83
84 /**
VinodKumarS-Huaweicb3a1f52016-05-10 17:58:57 +053085 * Adds the types of files being generated corresponding to the YANG
86 * definition.
87 *
88 * @param fileTypes the types of files being generated corresponding to the
89 * YANG definition
90 */
91 public void addGeneratedFileTypes(int fileTypes) {
92 genFileTypes |= fileTypes;
93 }
94
95 /**
Bharat saraswald9822e92016-04-05 15:13:44 +053096 * Returns the java name of the node.
Vinod Kumar S38046502016-03-23 15:30:27 +053097 *
98 * @return the java name of node
99 */
100 public String getJavaName() {
101 return javaName;
102 }
103
104 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530105 * Sets the java name of the node.
Vinod Kumar S38046502016-03-23 15:30:27 +0530106 *
107 * @param name the java name of node
108 */
109 public void setJavaName(String name) {
110 javaName = name;
111 }
112
113 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530114 * Returns the mapped java package.
Vinod Kumar S38046502016-03-23 15:30:27 +0530115 *
116 * @return the java package
117 */
118 public String getPackage() {
Vinod Kumar S38046502016-03-23 15:30:27 +0530119 return pkg;
120 }
121
122 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530123 * Sets the node's package.
Vinod Kumar S38046502016-03-23 15:30:27 +0530124 *
125 * @param nodePackage node's package
126 */
127 public void setPackage(String nodePackage) {
128 pkg = nodePackage;
129 }
130
131 /**
132 * Sets directory package path for code generation.
133 *
134 * @param path directory package path for code generation
135 */
136 public void setPackageFilePath(String path) {
137 relativeFilePath = path;
138 }
139
140 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530141 * Returns directory package path for code generation.
Vinod Kumar S38046502016-03-23 15:30:27 +0530142 *
143 * @return directory package path for code generation
144 */
145 public String getPackageFilePath() {
146 return relativeFilePath;
147 }
148
149 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530150 * Returns base directory package path for code generation.
Vinod Kumar S38046502016-03-23 15:30:27 +0530151 *
152 * @return directory package path for code generation
153 */
154 public String getBaseCodeGenPath() {
155 return codeGenDirFilePath;
156 }
157
158 /**
159 * Sets base directory package path for code generation.
160 *
161 * @param path base directory path
162 */
163 public void setBaseCodeGenPath(String path) {
164 codeGenDirFilePath = path;
165 }
Bharat saraswal33dfa012016-05-17 19:59:16 +0530166
167 /**
168 * Returns plugin configurations.
169 *
170 * @return the pluginConfig
171 */
172 public YangPluginConfig getPluginConfig() {
173 return pluginConfig;
174 }
175
176 /**
177 * Sets plugin configurations.
178 *
179 * @param pluginConfig the pluginConfig to set
180 */
181 public void setPluginConfig(YangPluginConfig pluginConfig) {
182 this.pluginConfig = pluginConfig;
183 }
Vinod Kumar S38046502016-03-23 15:30:27 +0530184}