blob: 3a538841c858076c5649958920909bb41605cc7c [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
19/**
Bharat saraswald9822e92016-04-05 15:13:44 +053020 * Represents cached java file handle, which supports the addition of member attributes and
Vinod Kumar S38046502016-03-23 15:30:27 +053021 * methods.
22 */
23public class JavaFileInfo {
Bharat saraswal6ef0b762016-04-05 12:45:45 +053024
Vinod Kumar S38046502016-03-23 15:30:27 +053025 /**
26 * The type(s) of java source file(s) to be generated when the cached file
27 * handle is closed.
28 */
29 private int genFileTypes;
30
31 /**
32 * Name of the module.
33 */
34 private String javaName;
35
36 /**
Bharat saraswalcc1cdab2016-04-16 02:28:25 +053037 * Java Package of the mapped java class.
Vinod Kumar S38046502016-03-23 15:30:27 +053038 */
39 private String pkg;
40
41 /**
42 * File generation directory path.
43 */
44 private String relativeFilePath;
45
46 /**
47 * File generation base directory path.
48 */
49 private String codeGenDirFilePath;
50
51 /**
Bharat saraswald9822e92016-04-05 15:13:44 +053052 * Returns the types of files being generated corresponding to the YANG
Vinod Kumar S38046502016-03-23 15:30:27 +053053 * definition.
54 *
55 * @return the types of files being generated corresponding to the YANG
VinodKumarS-Huaweicb3a1f52016-05-10 17:58:57 +053056 * definition
Vinod Kumar S38046502016-03-23 15:30:27 +053057 */
58 public int getGeneratedFileTypes() {
59 return genFileTypes;
60 }
61
62 /**
Bharat saraswald9822e92016-04-05 15:13:44 +053063 * Sets the types of files being generated corresponding to the YANG
Vinod Kumar S38046502016-03-23 15:30:27 +053064 * definition.
65 *
66 * @param fileTypes the types of files being generated corresponding to the
VinodKumarS-Huaweicb3a1f52016-05-10 17:58:57 +053067 * YANG definition
Vinod Kumar S38046502016-03-23 15:30:27 +053068 */
69 public void setGeneratedFileTypes(int fileTypes) {
70 genFileTypes = fileTypes;
71 }
72
73 /**
VinodKumarS-Huaweicb3a1f52016-05-10 17:58:57 +053074 * Adds the types of files being generated corresponding to the YANG
75 * definition.
76 *
77 * @param fileTypes the types of files being generated corresponding to the
78 * YANG definition
79 */
80 public void addGeneratedFileTypes(int fileTypes) {
81 genFileTypes |= fileTypes;
82 }
83
84 /**
Bharat saraswald9822e92016-04-05 15:13:44 +053085 * Returns the java name of the node.
Vinod Kumar S38046502016-03-23 15:30:27 +053086 *
87 * @return the java name of node
88 */
89 public String getJavaName() {
90 return javaName;
91 }
92
93 /**
Bharat saraswald9822e92016-04-05 15:13:44 +053094 * Sets the java name of the node.
Vinod Kumar S38046502016-03-23 15:30:27 +053095 *
96 * @param name the java name of node
97 */
98 public void setJavaName(String name) {
99 javaName = name;
100 }
101
102 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530103 * Returns the mapped java package.
Vinod Kumar S38046502016-03-23 15:30:27 +0530104 *
105 * @return the java package
106 */
107 public String getPackage() {
Vinod Kumar S38046502016-03-23 15:30:27 +0530108 return pkg;
109 }
110
111 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530112 * Sets the node's package.
Vinod Kumar S38046502016-03-23 15:30:27 +0530113 *
114 * @param nodePackage node's package
115 */
116 public void setPackage(String nodePackage) {
117 pkg = nodePackage;
118 }
119
120 /**
121 * Sets directory package path for code generation.
122 *
123 * @param path directory package path for code generation
124 */
125 public void setPackageFilePath(String path) {
126 relativeFilePath = path;
127 }
128
129 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530130 * Returns directory package path for code generation.
Vinod Kumar S38046502016-03-23 15:30:27 +0530131 *
132 * @return directory package path for code generation
133 */
134 public String getPackageFilePath() {
135 return relativeFilePath;
136 }
137
138 /**
Bharat saraswald9822e92016-04-05 15:13:44 +0530139 * Returns base directory package path for code generation.
Vinod Kumar S38046502016-03-23 15:30:27 +0530140 *
141 * @return directory package path for code generation
142 */
143 public String getBaseCodeGenPath() {
144 return codeGenDirFilePath;
145 }
146
147 /**
148 * Sets base directory package path for code generation.
149 *
150 * @param path base directory path
151 */
152 public void setBaseCodeGenPath(String path) {
153 codeGenDirFilePath = path;
154 }
155}