feat(REQ-5965) - 调整枚举的 valueof 方法
This commit is contained in:
parent
701a2009ab
commit
f6c13979aa
@ -35,6 +35,16 @@ public enum FileTypeEnum {
|
|||||||
return fromValue(type);
|
return fromValue(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static FileTypeEnum valueOfLikeSuffix(String suffix) {
|
||||||
|
if (suffix == null) {
|
||||||
|
return UNKNOWN;
|
||||||
|
}
|
||||||
|
return Arrays.stream(FileTypeEnum.values())
|
||||||
|
.filter(e -> e.getSuffix().contains(suffix))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(UNKNOWN);
|
||||||
|
}
|
||||||
|
|
||||||
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
|
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
|
||||||
public static FileTypeEnum fromValue(String value) {
|
public static FileTypeEnum fromValue(String value) {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user