enum 增加 valueOfType
This commit is contained in:
parent
e4dc715458
commit
c75e415b61
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue