Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | 0f7908b | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Laboratory |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 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 | |
| 17 | package org.onosproject.yangutils.translator.tojava; |
| 18 | |
Bharat saraswal | c2d3be1 | 2016-06-16 00:29:12 +0530 | [diff] [blame^] | 19 | import java.io.Serializable; |
| 20 | |
Bharat saraswal | 715d3fc | 2016-05-17 19:59:16 +0530 | [diff] [blame] | 21 | import org.onosproject.yangutils.translator.tojava.utils.YangPluginConfig; |
| 22 | |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 23 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 24 | * Represents cached java file handle, which supports the addition of member attributes and |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 25 | * methods. |
| 26 | */ |
Bharat saraswal | c2d3be1 | 2016-06-16 00:29:12 +0530 | [diff] [blame^] | 27 | public class JavaFileInfo implements Serializable { |
| 28 | |
| 29 | private static final long serialVersionUID = 806102633L; |
Bharat saraswal | 780eca3 | 2016-04-05 12:45:45 +0530 | [diff] [blame] | 30 | |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 31 | /** |
| 32 | * The type(s) of java source file(s) to be generated when the cached file |
| 33 | * handle is closed. |
| 34 | */ |
Bharat saraswal | c2d3be1 | 2016-06-16 00:29:12 +0530 | [diff] [blame^] | 35 | private transient int genFileTypes; |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 36 | |
| 37 | /** |
| 38 | * Name of the module. |
| 39 | */ |
| 40 | private String javaName; |
| 41 | |
| 42 | /** |
Bharat saraswal | e2bc60d | 2016-04-16 02:28:25 +0530 | [diff] [blame] | 43 | * Java Package of the mapped java class. |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 44 | */ |
| 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 saraswal | 715d3fc | 2016-05-17 19:59:16 +0530 | [diff] [blame] | 58 | * Plugin configuration for naming convention. |
| 59 | */ |
Bharat saraswal | c2d3be1 | 2016-06-16 00:29:12 +0530 | [diff] [blame^] | 60 | private transient YangPluginConfig pluginConfig; |
Bharat saraswal | 715d3fc | 2016-05-17 19:59:16 +0530 | [diff] [blame] | 61 | |
| 62 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 63 | * Returns the types of files being generated corresponding to the YANG |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 64 | * definition. |
| 65 | * |
| 66 | * @return the types of files being generated corresponding to the YANG |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 67 | * definition |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 68 | */ |
| 69 | public int getGeneratedFileTypes() { |
| 70 | return genFileTypes; |
| 71 | } |
| 72 | |
| 73 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 74 | * Sets the types of files being generated corresponding to the YANG |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 75 | * definition. |
| 76 | * |
| 77 | * @param fileTypes the types of files being generated corresponding to the |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 78 | * YANG definition |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 79 | */ |
| 80 | public void setGeneratedFileTypes(int fileTypes) { |
| 81 | genFileTypes = fileTypes; |
| 82 | } |
| 83 | |
| 84 | /** |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 85 | * 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 saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 96 | * Returns the java name of the node. |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 97 | * |
| 98 | * @return the java name of node |
| 99 | */ |
| 100 | public String getJavaName() { |
| 101 | return javaName; |
| 102 | } |
| 103 | |
| 104 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 105 | * Sets the java name of the node. |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 106 | * |
| 107 | * @param name the java name of node |
| 108 | */ |
| 109 | public void setJavaName(String name) { |
| 110 | javaName = name; |
| 111 | } |
| 112 | |
| 113 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 114 | * Returns the mapped java package. |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 115 | * |
| 116 | * @return the java package |
| 117 | */ |
| 118 | public String getPackage() { |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 119 | return pkg; |
| 120 | } |
| 121 | |
| 122 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 123 | * Sets the node's package. |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 124 | * |
| 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 saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 141 | * Returns directory package path for code generation. |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 142 | * |
| 143 | * @return directory package path for code generation |
| 144 | */ |
| 145 | public String getPackageFilePath() { |
| 146 | return relativeFilePath; |
| 147 | } |
| 148 | |
| 149 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 150 | * Returns base directory package path for code generation. |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 151 | * |
| 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 saraswal | 715d3fc | 2016-05-17 19:59:16 +0530 | [diff] [blame] | 166 | |
| 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 S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 184 | } |