Bharat saraswal | e50edca | 2016-08-05 01:58:25 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016-present Open Networking Laboratory |
| 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 | import org.onosproject.yangutils.datamodel.javadatamodel.JavaFileInfo; |
| 20 | import org.onosproject.yangutils.utils.io.YangPluginConfig; |
| 21 | |
| 22 | /** |
| 23 | * Represents cached java file handle, which supports the addition of member attributes and |
| 24 | * methods. |
| 25 | */ |
| 26 | public class JavaFileInfoTranslator extends JavaFileInfo { |
| 27 | |
| 28 | private static final long serialVersionUID = 806102633L; |
| 29 | |
| 30 | /** |
| 31 | * The type(s) of java source file(s) to be generated when the cached file |
| 32 | * handle is closed. |
| 33 | */ |
| 34 | private transient int genFileTypes; |
| 35 | |
| 36 | /** |
| 37 | * File generation directory path. |
| 38 | */ |
| 39 | private transient String relativeFilePath; |
| 40 | |
| 41 | /** |
| 42 | * File generation base directory path. |
| 43 | */ |
| 44 | private transient String codeGenDirFilePath; |
| 45 | |
| 46 | /** |
| 47 | * Plugin configuration for naming convention. |
| 48 | */ |
| 49 | private transient YangPluginConfig pluginConfig; |
| 50 | |
| 51 | /** |
| 52 | * Returns the types of files being generated corresponding to the YANG |
| 53 | * definition. |
| 54 | * |
| 55 | * @return the types of files being generated corresponding to the YANG |
| 56 | * definition |
| 57 | */ |
| 58 | public int getGeneratedFileTypes() { |
| 59 | return genFileTypes; |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * Sets the types of files being generated corresponding to the YANG |
| 64 | * definition. |
| 65 | * |
| 66 | * @param fileTypes the types of files being generated corresponding to the |
| 67 | * YANG definition |
| 68 | */ |
| 69 | public void setGeneratedFileTypes(int fileTypes) { |
| 70 | genFileTypes = fileTypes; |
| 71 | } |
| 72 | |
| 73 | /** |
| 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 | /** |
| 85 | * Sets directory package path for code generation. |
| 86 | * |
| 87 | * @param path directory package path for code generation |
| 88 | */ |
| 89 | public void setPackageFilePath(String path) { |
| 90 | relativeFilePath = path; |
| 91 | } |
| 92 | |
| 93 | /** |
| 94 | * Returns directory package path for code generation. |
| 95 | * |
| 96 | * @return directory package path for code generation |
| 97 | */ |
| 98 | public String getPackageFilePath() { |
| 99 | return relativeFilePath; |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * Returns base directory package path for code generation. |
| 104 | * |
| 105 | * @return directory package path for code generation |
| 106 | */ |
| 107 | public String getBaseCodeGenPath() { |
| 108 | return codeGenDirFilePath; |
| 109 | } |
| 110 | |
| 111 | /** |
| 112 | * Sets base directory package path for code generation. |
| 113 | * |
| 114 | * @param path base directory path |
| 115 | */ |
| 116 | public void setBaseCodeGenPath(String path) { |
| 117 | codeGenDirFilePath = path; |
| 118 | } |
| 119 | |
| 120 | /** |
| 121 | * Returns plugin configurations. |
| 122 | * |
| 123 | * @return the pluginConfig |
| 124 | */ |
| 125 | public YangPluginConfig getPluginConfig() { |
| 126 | return pluginConfig; |
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * Sets plugin configurations. |
| 131 | * |
| 132 | * @param pluginConfig the pluginConfig to set |
| 133 | */ |
| 134 | public void setPluginConfig(YangPluginConfig pluginConfig) { |
| 135 | this.pluginConfig = pluginConfig; |
| 136 | } |
| 137 | } |