Hi I'm having trouble trying to generalize a function I've written for an specific enum:
public static enum InstrumentType {
    SPOT {
        public String toString() {
            return "MKP";
        }
    },
    VOLATILITY {
        public String toString() {
            return "VOL";
        }
    };
    public static InstrumentType parseXML(String value) {
        InstrumentType ret = InstrumentType.SPOT;
        for(InstrumentType instrumentType : values()) {
            if(instrumentType.toString().equalsIgnoreCase(value)) {
                ret = instrumentType;
                break;
            }
        }
        return ret;
    }
} 
I wish to add a new parameter to the function that will represent any enum. I know I'm supposed to use templates but I can't use the function "values()" then inside the function code. Basicly what I want is a valueOf function that uses the toString() value I've defined.
Thanks in advance.
 
     
     
    