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 | |
| 19 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 20 | * 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] | 21 | * methods. |
| 22 | */ |
| 23 | public class JavaFileInfo { |
Bharat saraswal | 780eca3 | 2016-04-05 12:45:45 +0530 | [diff] [blame] | 24 | |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 25 | /** |
| 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 saraswal | e2bc60d | 2016-04-16 02:28:25 +0530 | [diff] [blame] | 37 | * Java Package of the mapped java class. |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 38 | */ |
| 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 saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 52 | * Returns the types of files being generated corresponding to the YANG |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 53 | * definition. |
| 54 | * |
| 55 | * @return the types of files being generated corresponding to the YANG |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 56 | * definition |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 57 | */ |
| 58 | public int getGeneratedFileTypes() { |
| 59 | return genFileTypes; |
| 60 | } |
| 61 | |
| 62 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 63 | * Sets 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 | * @param fileTypes the types of files being generated corresponding to the |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 67 | * YANG definition |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 68 | */ |
| 69 | public void setGeneratedFileTypes(int fileTypes) { |
| 70 | genFileTypes = fileTypes; |
| 71 | } |
| 72 | |
| 73 | /** |
VinodKumarS-Huawei | 6266db3 | 2016-05-10 17:58:57 +0530 | [diff] [blame] | 74 | * 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 saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 85 | * Returns the java name of the node. |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 86 | * |
| 87 | * @return the java name of node |
| 88 | */ |
| 89 | public String getJavaName() { |
| 90 | return javaName; |
| 91 | } |
| 92 | |
| 93 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 94 | * Sets the java name of the node. |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 95 | * |
| 96 | * @param name the java name of node |
| 97 | */ |
| 98 | public void setJavaName(String name) { |
| 99 | javaName = name; |
| 100 | } |
| 101 | |
| 102 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 103 | * Returns the mapped java package. |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 104 | * |
| 105 | * @return the java package |
| 106 | */ |
| 107 | public String getPackage() { |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 108 | return pkg; |
| 109 | } |
| 110 | |
| 111 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 112 | * Sets the node's package. |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 113 | * |
| 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 saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 130 | * Returns directory package path for code generation. |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 131 | * |
| 132 | * @return directory package path for code generation |
| 133 | */ |
| 134 | public String getPackageFilePath() { |
| 135 | return relativeFilePath; |
| 136 | } |
| 137 | |
| 138 | /** |
Bharat saraswal | 63f26fb | 2016-04-05 15:13:44 +0530 | [diff] [blame] | 139 | * Returns base directory package path for code generation. |
Vinod Kumar S | 9f26ae5 | 2016-03-23 15:30:27 +0530 | [diff] [blame] | 140 | * |
| 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 | } |