Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2016-present Open Networking Laboratory |
Vinod Kumar S | 3804650 | 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 | 33dfa01 | 2016-05-17 19:59:16 +0530 | [diff] [blame^] | 19 | import org.onosproject.yangutils.translator.tojava.utils.YangPluginConfig; |
| 20 | |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 21 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 22 | * Represents cached java file handle, which supports the addition of member attributes and |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 23 | * methods. |
| 24 | */ |
| 25 | public class JavaFileInfo { |
Bharat saraswal | 6ef0b76 | 2016-04-05 12:45:45 +0530 | [diff] [blame] | 26 | |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 27 | /** |
| 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 saraswal | cc1cdab | 2016-04-16 02:28:25 +0530 | [diff] [blame] | 39 | * Java Package of the mapped java class. |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 40 | */ |
| 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 saraswal | 33dfa01 | 2016-05-17 19:59:16 +0530 | [diff] [blame^] | 54 | * Plugin configuration for naming convention. |
| 55 | */ |
| 56 | private YangPluginConfig pluginConfig; |
| 57 | |
| 58 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 59 | * Returns the types of files being generated corresponding to the YANG |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 60 | * definition. |
| 61 | * |
| 62 | * @return the types of files being generated corresponding to the YANG |
VinodKumarS-Huawei | cb3a1f5 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 63 | * definition |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 64 | */ |
| 65 | public int getGeneratedFileTypes() { |
| 66 | return genFileTypes; |
| 67 | } |
| 68 | |
| 69 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 70 | * Sets the types of files being generated corresponding to the YANG |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 71 | * definition. |
| 72 | * |
| 73 | * @param fileTypes the types of files being generated corresponding to the |
VinodKumarS-Huawei | cb3a1f5 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 74 | * YANG definition |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 75 | */ |
| 76 | public void setGeneratedFileTypes(int fileTypes) { |
| 77 | genFileTypes = fileTypes; |
| 78 | } |
| 79 | |
| 80 | /** |
VinodKumarS-Huawei | cb3a1f5 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 81 | * 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 saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 92 | * Returns the java name of the node. |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 93 | * |
| 94 | * @return the java name of node |
| 95 | */ |
| 96 | public String getJavaName() { |
| 97 | return javaName; |
| 98 | } |
| 99 | |
| 100 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 101 | * Sets the java name of the node. |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 102 | * |
| 103 | * @param name the java name of node |
| 104 | */ |
| 105 | public void setJavaName(String name) { |
| 106 | javaName = name; |
| 107 | } |
| 108 | |
| 109 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 110 | * Returns the mapped java package. |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 111 | * |
| 112 | * @return the java package |
| 113 | */ |
| 114 | public String getPackage() { |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 115 | return pkg; |
| 116 | } |
| 117 | |
| 118 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 119 | * Sets the node's package. |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 120 | * |
| 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 saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 137 | * Returns directory package path for code generation. |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 138 | * |
| 139 | * @return directory package path for code generation |
| 140 | */ |
| 141 | public String getPackageFilePath() { |
| 142 | return relativeFilePath; |
| 143 | } |
| 144 | |
| 145 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 146 | * Returns base directory package path for code generation. |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 147 | * |
| 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 saraswal | 33dfa01 | 2016-05-17 19:59:16 +0530 | [diff] [blame^] | 162 | |
| 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 S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 180 | } |