public class enums {
public static String enumValue(String type) {
String val = "";
String[] origins = {"VISIT", "RECOMMEND", "LEAFLET", "ACTIVITY", "MEDIA", "MESSAGE", "NET", "PHONESALE", "FRIENDS", "OTHERS"};
String[] educations = {"DOCTOR", "POST_GRADUATE", "COLLEGE", "JUNIOR_COLLEGE", "HIGH_SCHOOL", "MIDDLE_SCHOOL", "SECONDARY_SCHOOL"};
if (type.equalsIgnoreCase("origin")) {
val = origins[(int) (Math.random() * origins.length)];
} else if (type.equalsIgnoreCase("education")) {
val = educations[(int) (Math.random() * educations.length)];
}
return val;
}
public static void main(String[] args) {
String sourceId = enumValue("educations");
System.out.println("名单来源是"+sourceId);
}
}