Below code helps to have enum through constructor
public enum ResultCode {
ResultCode_0("Balance was successfully updated.", "0"),
ResultCode_11("Nothing to do.", "11"),
private final String errorDesc;
private final String errorCode;
private States(String errorDesc, String errorCode) {
this.errorDesc= errorDesc;
this.errorCode= errorCode;
}
// setter and getter
}
public enum ResultCode {
ResultCode_0("Balance was successfully updated.", "0"),
ResultCode_11("Nothing to do.", "11"),
private final String errorDesc;
private final String errorCode;
private States(String errorDesc, String errorCode) {
this.errorDesc= errorDesc;
this.errorCode= errorCode;
}
// setter and getter
}
No comments:
Post a Comment