Enumeration constants are case sensitive, so make sure you are, in fact, lowercase. In addition, I would suggest that you trim()enter as well to make sure that it does not have scroll spaces:
ConfigProperties.valueOf(line[0].toLowerCase().trim())
For reference, here is a working program containing your line:
enum ConfigProperties { prop1, prop2 }
class Test {
public static void main(String[] args) {
String[] line = { "prop1" };
switch (ConfigProperties.valueOf(line[0].toLowerCase())) {
case prop1: System.out.println("Property 1"); break;
case prop2: System.out.println("Property 2"); break;
}
}
}
Conclusion:
Property 1
source
share