View Javadoc
1   /*
2    *    Copyright 2010-2025 the original author or authors.
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    *       https://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  package org.apache.ibatis.migration.options;
17  
18  import static org.apache.ibatis.migration.utils.Util.file;
19  
20  import java.io.File;
21  import java.nio.file.Path;
22  
23  public class SelectedPaths {
24    private File basePath = Path.of("./").toFile();
25    private File envPath;
26    private File scriptPath;
27    private File driverPath;
28    private File hookPath;
29  
30    public File getBasePath() {
31      return basePath;
32    }
33  
34    public File getEnvPath() {
35      return envPath == null ? file(basePath, "./environments") : envPath;
36    }
37  
38    public File getScriptPath() {
39      return scriptPath == null ? file(basePath, "./scripts") : scriptPath;
40    }
41  
42    public File getDriverPath() {
43      return driverPath == null ? file(basePath, "./drivers") : driverPath;
44    }
45  
46    public File getHookPath() {
47      return hookPath == null ? file(basePath, "./hooks") : hookPath;
48    }
49  
50    public void setBasePath(File aBasePath) {
51      basePath = aBasePath;
52    }
53  
54    public void setEnvPath(File aEnvPath) {
55      envPath = aEnvPath;
56    }
57  
58    public void setScriptPath(File aScriptPath) {
59      scriptPath = aScriptPath;
60    }
61  
62    public void setDriverPath(File aDriverPath) {
63      driverPath = aDriverPath;
64    }
65  
66    public void setHookPath(File aHookPath) {
67      hookPath = aHookPath;
68    }
69  }