Figure A code:
public enum Logmethodenum {
Webcscardvalid ("return value"),
Webcsverifypassword ("return value"),
Webcssavepassword ("return value"),
Webcssetpassword ("return value"),
Webcsquerytotalbalance ("return value"),
Webcsquerycarddetail ("return value"),
Webcsquerycompinfor ("return value"),
Webcsquerytotaldetail ("return value"),
Webcsqueryacardinforex ("return value"),
Webcsqueryacardinfor ("return value"),
Webcsquerycardinfor ("return value"),
Webcsquerycardaccount ("return value"),
WEBCSQUERYCARDINFOR_NP ("return value"),
Webcsquerycardno ("return value"),
Webcsquerycdbydate ("return value"),
Webcsquerytdbydate ("return value"),
Webcsquerybusireport ("return value"),
Webcsquerydistribute ("return value"),
Webcsdistotalbalance ("return value"),
Webcslostcard ("return value");
private String text;
Public String GetText () {
return text;
}
Public Logmethodenum (String text) {
This.text = text;
}
public static void Main (string[] args) {
String str= "Webcscardvalid";
String returnstr = logmethodenum.valueof (webcscardvalid). GetText ();
System.out.println (RETURNSTR);
}
}
Figure II Code:
public enum Logcodeanddescenum {
SUCCESS ("0000", "description"),
Unlawfl_newspaper ("0001", "description"),
Message_domain ("0002", "description");
Private String Code;
Private String desc;
Public String GetDesc () {
return desc;
}
Public String GetCode () {
return code;
}
Webservicelogstatusenum (String code,string desc) {
THIS.DESC = desc;
This.code = code;
}
public static String Codegetdesc (int value) {//is converted to a description according to the status code
if (string.valueof (value). Equals ("0098")) {
return SYSTEM_FAILURE.DESC;
}
if (string.valueof (value). Equals ("0099")) {
return SYSTEM_FAILURE_OTHER.DESC;
}
Switch (value) {
Case 0000:
return SUCCESS.DESC;
Case 0001:
return UNLAWFL_NEWSPAPER.DESC;
Case 0002:
return MESSAGE_DOMAIN.DESC;
Default
return null;
}
}
}
Article Source: https://www.cnblogs.com/0c7x4/, reproduced please mark the original
Java enum enum class