Try UsageType.valueOf(usageType.toUpperCase())
. When you use that method, the string should match the constant name (START
) and the case matters.
Note that I am using the enum name UsageType
because valueOf
is a static method. So, you should need an instance there.
Also, note that the valueOf
method throws IllegalArgumentException
, runtime excpetion, if no constant with the name exists.