It's perfectly legal to have an enum declared inside an
interface.
In this situation the interface is just used as a namespace for
the enum and nothing more. The interface is used normally wherever we use it.
public interface IService {
public enum Status { // enum
OK(200), INTERNAL_ERROR(500), KO(0);
private int errorCode;
private Status(int errorCode) {
this.errorCode = errorCode;
}
public int getErrorCode(){
return errorCode;
}
}
}
No comments:
Post a Comment