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 | |
Shankara-Huawei | bdf24bb | 2016-08-02 18:13:13 +0530 | [diff] [blame^] | 17 | package org.onosproject.yangutils.datamodel.javadatamodel; |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 18 | |
Bharat saraswal | 96dfef0 | 2016-06-16 00:29:12 +0530 | [diff] [blame] | 19 | import java.io.Serializable; |
| 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 | */ |
Bharat saraswal | 96dfef0 | 2016-06-16 00:29:12 +0530 | [diff] [blame] | 25 | public class JavaFileInfo implements Serializable { |
| 26 | |
| 27 | private static final long serialVersionUID = 806102633L; |
Bharat saraswal | 6ef0b76 | 2016-04-05 12:45:45 +0530 | [diff] [blame] | 28 | |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 29 | /** |
| 30 | * The type(s) of java source file(s) to be generated when the cached file |
| 31 | * handle is closed. |
| 32 | */ |
Bharat saraswal | 96dfef0 | 2016-06-16 00:29:12 +0530 | [diff] [blame] | 33 | private transient int genFileTypes; |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 34 | |
| 35 | /** |
| 36 | * Name of the module. |
| 37 | */ |
| 38 | private String javaName; |
| 39 | |
| 40 | /** |
Bharat saraswal | cc1cdab | 2016-04-16 02:28:25 +0530 | [diff] [blame] | 41 | * Java Package of the mapped java class. |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 42 | */ |
| 43 | private String pkg; |
| 44 | |
| 45 | /** |
| 46 | * File generation directory path. |
| 47 | */ |
| 48 | private String relativeFilePath; |
| 49 | |
| 50 | /** |
| 51 | * File generation base directory path. |
| 52 | */ |
| 53 | private String codeGenDirFilePath; |
| 54 | |
| 55 | /** |
Bharat saraswal | 33dfa01 | 2016-05-17 19:59:16 +0530 | [diff] [blame] | 56 | * Plugin configuration for naming convention. |
| 57 | */ |
Bharat saraswal | 96dfef0 | 2016-06-16 00:29:12 +0530 | [diff] [blame] | 58 | private transient YangPluginConfig pluginConfig; |
Bharat saraswal | 33dfa01 | 2016-05-17 19:59:16 +0530 | [diff] [blame] | 59 | |
| 60 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 61 | * Returns the types of files being generated corresponding to the YANG |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 62 | * definition. |
| 63 | * |
| 64 | * @return the types of files being generated corresponding to the YANG |
VinodKumarS-Huawei | cb3a1f5 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 65 | * definition |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 66 | */ |
| 67 | public int getGeneratedFileTypes() { |
| 68 | return genFileTypes; |
| 69 | } |
| 70 | |
| 71 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 72 | * Sets the types of files being generated corresponding to the YANG |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 73 | * definition. |
| 74 | * |
| 75 | * @param fileTypes the types of files being generated corresponding to the |
Shankara-Huawei | bdf24bb | 2016-08-02 18:13:13 +0530 | [diff] [blame^] | 76 | * YANG definition |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 77 | */ |
| 78 | public void setGeneratedFileTypes(int fileTypes) { |
| 79 | genFileTypes = fileTypes; |
| 80 | } |
| 81 | |
| 82 | /** |
VinodKumarS-Huawei | cb3a1f5 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 83 | * Adds the types of files being generated corresponding to the YANG |
| 84 | * definition. |
| 85 | * |
| 86 | * @param fileTypes the types of files being generated corresponding to the |
Shankara-Huawei | bdf24bb | 2016-08-02 18:13:13 +0530 | [diff] [blame^] | 87 | * YANG definition |
VinodKumarS-Huawei | cb3a1f5 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 88 | */ |
| 89 | public void addGeneratedFileTypes(int fileTypes) { |
| 90 | genFileTypes |= fileTypes; |
| 91 | } |
| 92 | |
| 93 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 94 | * Returns the java name of the node. |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 95 | * |
| 96 | * @return the java name of node |
| 97 | */ |
| 98 | public String getJavaName() { |
| 99 | return javaName; |
| 100 | } |
| 101 | |
| 102 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 103 | * Sets the java name of the node. |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 104 | * |
| 105 | * @param name the java name of node |
| 106 | */ |
| 107 | public void setJavaName(String name) { |
| 108 | javaName = name; |
| 109 | } |
| 110 | |
| 111 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 112 | * Returns the mapped java package. |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 113 | * |
| 114 | * @return the java package |
| 115 | */ |
| 116 | public String getPackage() { |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 117 | return pkg; |
| 118 | } |
| 119 | |
| 120 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 121 | * Sets the node's package. |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 122 | * |
| 123 | * @param nodePackage node's package |
| 124 | */ |
| 125 | public void setPackage(String nodePackage) { |
| 126 | pkg = nodePackage; |
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * Sets directory package path for code generation. |
| 131 | * |
| 132 | * @param path directory package path for code generation |
| 133 | */ |
| 134 | public void setPackageFilePath(String path) { |
| 135 | relativeFilePath = path; |
| 136 | } |
| 137 | |
| 138 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 139 | * Returns directory package path for code generation. |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 140 | * |
| 141 | * @return directory package path for code generation |
| 142 | */ |
| 143 | public String getPackageFilePath() { |
| 144 | return relativeFilePath; |
| 145 | } |
| 146 | |
| 147 | /** |
Bharat saraswal | d9822e9 | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 148 | * Returns base directory package path for code generation. |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 149 | * |
| 150 | * @return directory package path for code generation |
| 151 | */ |
| 152 | public String getBaseCodeGenPath() { |
| 153 | return codeGenDirFilePath; |
| 154 | } |
| 155 | |
| 156 | /** |
| 157 | * Sets base directory package path for code generation. |
| 158 | * |
| 159 | * @param path base directory path |
| 160 | */ |
| 161 | public void setBaseCodeGenPath(String path) { |
| 162 | codeGenDirFilePath = path; |
| 163 | } |
Bharat saraswal | 33dfa01 | 2016-05-17 19:59:16 +0530 | [diff] [blame] | 164 | |
| 165 | /** |
| 166 | * Returns plugin configurations. |
| 167 | * |
| 168 | * @return the pluginConfig |
| 169 | */ |
| 170 | public YangPluginConfig getPluginConfig() { |
| 171 | return pluginConfig; |
| 172 | } |
| 173 | |
| 174 | /** |
| 175 | * Sets plugin configurations. |
| 176 | * |
| 177 | * @param pluginConfig the pluginConfig to set |
| 178 | */ |
| 179 | public void setPluginConfig(YangPluginConfig pluginConfig) { |
| 180 | this.pluginConfig = pluginConfig; |
| 181 | } |
Vinod Kumar S | 3804650 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 182 | } |