Consider the following enum class

public enum ClassA { CHECK1("X", 0), CHECK2("Y", 2), CHECK3("Z", 1); private final String id; private final String cdValue; private ClsA(String id, String cdValue) { this.id = id; this.cdValue = cdValue; } private String getId() { return id; } private String getCdValue() { return cdValue ; } private static final List cdValues = new ArrayList(); static { for (ClassA clsA : ClassA.values()) { cdValues.add(clsA.getCdValue()); } } public boolean isCdValue(String cdValue) { if clsValues.contains(cdValue) return true; else return false; } }The question that I have is does the method isCdValue has to be static. I have to use this method isCdValue for every input given by the client. Therefore the method parameter cdValue changes for every input.
If it cannot be static then I would like to know how I can access this method. Please note I am primarily interested in learning about static of non-static method call. If it is a non-static call in a enum then how can we call this non static method. I am not trying to resolve the issue of how to get about checking the cdValue exists or not. It is just an example.


Check Solution