TASK:模块化;
This commit is contained in:
@@ -40,4 +40,6 @@ public class LibraryUploadDTO {
|
||||
|
||||
private String modelSex;
|
||||
|
||||
private String ageGroup;
|
||||
|
||||
}
|
||||
|
||||
31
src/main/java/com/ai/da/model/enums/AgeGroup.java
Normal file
31
src/main/java/com/ai/da/model/enums/AgeGroup.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package com.ai.da.model.enums;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import lombok.Data;
|
||||
|
||||
public enum AgeGroup implements IEnumDisplay {
|
||||
ADULT("Adult"),
|
||||
CHILD("Child")
|
||||
;
|
||||
|
||||
private String value;
|
||||
|
||||
AgeGroup(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public static AgeGroup getAgeGroup(String value) {
|
||||
for (AgeGroup group : values()) {
|
||||
if (group.value.equalsIgnoreCase(value)) {
|
||||
return group;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("No matching constant for [" + value + "]");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user