I have the following listing:
public enum Status implements StringEnum{ ONLINE("on"),OFFLINE("off"); private String status = null; private Status(String status) { this.status = status; } public String toString() { return this.status; } public static Status find(String value) { for(Status status : Status.values()) { if(status.toString().equals(value)) { return status; } } throw new IllegalArgumentException("Unknown value: " + value ); } }
Is it possible to build a StringEnum interface to make sure all enums have find (), toString () and a constructor?
Thanks.
serg source share