增加 AppConfig.java 的注释

This commit is contained in:
许轲 2023-10-11 02:07:39 +08:00
parent 464532b509
commit 7d4123ba50

View File

@ -14,7 +14,12 @@ import static org.jcnc.jnotepad.common.constants.AppConstants.PROGRAM_FILE_DIREC
/** /**
* 应用程序配置文件 * 应用程序配置文件
* *
* <p>
* 此类用于存储应用程序的配置信息包括程序根路径排除的文件夹和文件等
* </p>
*
* @author gewuyou * @author gewuyou
*
*/ */
public class AppConfig { public class AppConfig {
/** /**
@ -37,6 +42,9 @@ public class AppConfig {
@JsonIgnore @JsonIgnore
private String lastRootPath; private String lastRootPath;
/**
* 构造应用程序配置对象
*/
public AppConfig() { public AppConfig() {
ignoreFolder = Set.of( ignoreFolder = Set.of(
new File(Paths.get(System.getProperty(DEFAULT_PROPERTY), PROGRAM_FILE_DIRECTORY, "system").toString()), new File(Paths.get(System.getProperty(DEFAULT_PROPERTY), PROGRAM_FILE_DIRECTORY, "system").toString()),
@ -45,26 +53,56 @@ public class AppConfig {
ignoreFile = Collections.emptySet(); ignoreFile = Collections.emptySet();
} }
/**
* 获取程序根路径
*
* @return 程序根路径
*/
public String getRootPath() { public String getRootPath() {
return Optional.ofNullable(rootPath).orElse(System.getProperty(DEFAULT_PROPERTY)); return Optional.ofNullable(rootPath).orElse(System.getProperty(DEFAULT_PROPERTY));
} }
/**
* 设置程序根路径
*
* @param rootPath 程序根路径
*/
public void setRootPath(String rootPath) { public void setRootPath(String rootPath) {
this.rootPath = rootPath; this.rootPath = rootPath;
} }
/**
* 获取上次的程序根路径
*
* @return 上次的程序根路径
*/
public String getLastRootPath() { public String getLastRootPath() {
return lastRootPath; return lastRootPath;
} }
/**
* 设置上次的程序根路径
*
* @param lastRootPath 上次的程序根路径
*/
public void setLastRootPath(String lastRootPath) { public void setLastRootPath(String lastRootPath) {
this.lastRootPath = lastRootPath; this.lastRootPath = lastRootPath;
} }
/**
* 获取排除的文件夹集合
*
* @return 排除的文件夹集合
*/
public Set<File> getIgnoreFolder() { public Set<File> getIgnoreFolder() {
return ignoreFolder; return ignoreFolder;
} }
/**
* 获取排除的文件集合
*
* @return 排除的文件集合
*/
public Set<File> getIgnoreFile() { public Set<File> getIgnoreFile() {
return ignoreFile; return ignoreFile;
} }