Enumeration of use (limited foton)

use:

/ **
* Service authenticity label
*
* @param realRepairs
* real repair singular
* @param totalRepairs
* Total singular
* @return
* /
public static AuthenticityType getAuthenticityTag (realRepairs int, int totalRepairs) {
Double Rate = ArithUtil.div (realRepairs, totalRepairs);
IF (Rate> = 0.9) {
return AuthenticityType.TOP90;
} the else IF (Rate> = 0.6) {
return AuthenticityType.TOP60;
} the else {
return AuthenticityType.UNDER60;
}
}

 

POJO

public class ServicerProfile {

private Long servicerId;
private String servicerCode;
private String servicerName;

public enum AuthenticityType {

TOP90 (31, "excellent"), TOP60 (32, "good"), UNDER60 (33, "fail");

private final int value;
private final String description;

private static final Map<Integer, AuthenticityType> valuesMap = Maps.newHashMap();
private static final Map<String, AuthenticityType> namesMap = Maps.newHashMap();
static {
for (AuthenticityType type : AuthenticityType.values()) {
valuesMap.put(type.getValue(), type);
namesMap.put(type.name(), type);
}
}

private AuthenticityType(int value, String description) {
this.value = value;
this.description = description;
}

public static AuthenticityType parse(Integer value) {
if (value == null) {
return null;
}

return valuesMap.get(value);
}

public static AuthenticityType parse(String name) {
if (name == null) {
return null;
}

return namesMap.get(name);
}

public Integer getValue() {
return value;
}

public String getDescription() {
return description;
}
}

}

Guess you like

Origin www.cnblogs.com/charkey/p/10953781.html