static < E extends Enum < E > > E readEnum ( Node node , Class < E > enumClass ) { if ( node == null ) { throw new XmlException ( "Tried to read " + enumClass . getSimpleName ( ) + " value from null node" ) ; } String value = node . getFirstChild ( ) . getNodeValue ( ) ; if ( value == null ) { throw new XmlException ( "Tried to read " + enumClass . getSimpleName ( ) + " value from null value" ) ; } try { return Enum . valueOf ( enumClass , value ) ; } catch ( IllegalArgumentException e ) { throw new XmlException ( "No valid " + enumClass . getSimpleName ( ) + ": \"" + value + "\"" ) ; } }
Parse an enum value from the first child of the given node .