Files
senmesh-zc/src/main/java/com/senmesh/sfile/constant/FileLocationEnum.java
2026-01-05 16:35:46 +08:00

60 lines
1.1 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package com.senmesh.sfile.constant;
/**
* 文件位置枚举
*/
public enum FileLocationEnum {
/**
* 内网
*/
INTERNAL("1", "内网"),
/**
* 外网
*/
EXTERNAL("2", "外网");
private final String location;
private final String desc;
FileLocationEnum(String location, String desc) {
this.location = location;
this.desc = desc;
}
public String getLocation() {
return location;
}
public String getDesc() {
return desc;
}
/**
* 根据位置获取枚举
*
* @param location 位置
* @return FileLocationEnum
*/
public static FileLocationEnum getByLocation(String location) {
for (FileLocationEnum fileLocationEnum : FileLocationEnum.values()) {
if (fileLocationEnum.getLocation().equals(location)) {
return fileLocationEnum;
}
}
return null;
}
/**
* 判断是否为内网
*
* @param location 位置
* @return true-内网,false-外网
*/
public static boolean isInternal(String location) {
return INTERNAL.getLocation().equals(location);
}
}