blob: 8b69fca70b99cbbf294abb927490d218a2330440 [file] [log] [blame]
Vinod Kumar S38046502016-03-23 15:30:27 +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
19/**
20 * Cached java file handle, which supports the addition of member attributes and
21 * methods.
22 */
23public class JavaFileInfo {
24 /**
25 * The type(s) of java source file(s) to be generated when the cached file
26 * handle is closed.
27 */
28 private int genFileTypes;
29
30 /**
31 * Name of the module.
32 */
33 private String javaName;
34
35 /**
36 * java Package of the mapped java class.
37 */
38 private String pkg;
39
40 /**
41 * File generation directory path.
42 */
43 private String relativeFilePath;
44
45 /**
46 * File generation base directory path.
47 */
48 private String codeGenDirFilePath;
49
50 /**
51 * Get the types of files being generated corresponding to the YANG
52 * definition.
53 *
54 * @return the types of files being generated corresponding to the YANG
55 * definition
56 */
57 public int getGeneratedFileTypes() {
58 return genFileTypes;
59 }
60
61 /**
62 * Set the types of files being generated corresponding to the YANG
63 * definition.
64 *
65 * @param fileTypes the types of files being generated corresponding to the
66 * YANG definition
67 */
68 public void setGeneratedFileTypes(int fileTypes) {
69 genFileTypes = fileTypes;
70 }
71
72 /**
73 * Get the java name of the node.
74 *
75 * @return the java name of node
76 */
77 public String getJavaName() {
78 return javaName;
79 }
80
81 /**
82 * Set the java name of the node.
83 *
84 * @param name the java name of node
85 */
86 public void setJavaName(String name) {
87 javaName = name;
88 }
89
90 /**
91 * Get the mapped java package.
92 *
93 * @return the java package
94 */
95 public String getPackage() {
96 if (pkg == null) {
97 throw new RuntimeException("Referencing package of a generated java file which is not set");
98 }
99 return pkg;
100 }
101
102 /**
103 * Set the node's package.
104 *
105 * @param nodePackage node's package
106 */
107 public void setPackage(String nodePackage) {
108 pkg = nodePackage;
109 }
110
111 /**
112 * Sets directory package path for code generation.
113 *
114 * @param path directory package path for code generation
115 */
116 public void setPackageFilePath(String path) {
117 relativeFilePath = path;
118 }
119
120 /**
121 * Gets directory package path for code generation.
122 *
123 * @return directory package path for code generation
124 */
125 public String getPackageFilePath() {
126 return relativeFilePath;
127 }
128
129 /**
130 * Gets base directory package path for code generation.
131 *
132 * @return directory package path for code generation
133 */
134 public String getBaseCodeGenPath() {
135 return codeGenDirFilePath;
136 }
137
138 /**
139 * Sets base directory package path for code generation.
140 *
141 * @param path base directory path
142 */
143 public void setBaseCodeGenPath(String path) {
144 codeGenDirFilePath = path;
145 }
146}