enum 增加 valueOfType

This commit is contained in:
cherishsince 2024-04-24 16:47:32 +08:00
parent e4dc715458
commit c75e415b61
2 changed files with 21 additions and 0 deletions

View File

@ -23,4 +23,14 @@ public enum ChatRoleSourceEnum {
private String type;
private String name;
public static ChatRoleSourceEnum valueOfType(String type) {
for (ChatRoleSourceEnum itemEnum : ChatRoleSourceEnum.values()) {
if (itemEnum.getType().equals(type)) {
return itemEnum;
}
}
throw new IllegalArgumentException("Invalid MessageType value: " + type);
}
}

View File

@ -22,4 +22,15 @@ public enum ChatRoleVisibilityEnum {
private String type;
private String name;
public static ChatRoleVisibilityEnum valueOfType(String type) {
for (ChatRoleVisibilityEnum itemEnum : ChatRoleVisibilityEnum.values()) {
if (itemEnum.getType().equals(type)) {
return itemEnum;
}
}
throw new IllegalArgumentException("Invalid MessageType value: " + type);
}
}