public <T extends Enum<T>>T consumeEnum(String name,boolean required,Class<T> enumClass,T defaultValue) throws ParseException {
  String value=consume(name,required);
  if (value == null) {
    return defaultValue;
  }
  try {
    return Enum.valueOf(enumClass,value.toUpperCase());
  }
 catch (  IllegalArgumentException e) {
    ParseException pe=new ParseException(CoreErrorDomain.ERR.invalidAttributeValue,e);
    pe.setInternalReason("Invalid value for attribute : '" + name + "'");
    throw pe;
  }
}

public < T extends Enum < T > > T consumeEnum ( String name , boolean required , Class < T > enumClass , T defaultValue ) throws ParseException { String value = consume ( name , required ) ; if ( value == null ) { return defaultValue ; } try { return Enum . valueOf ( enumClass , value . toUpperCase ( ) ) ; } catch ( IllegalArgumentException e ) { ParseException pe = new ParseException ( CoreErrorDomain . ERR . invalidAttributeValue , e ) ; pe . setInternalReason ( "Invalid value for attribute : '" + name + "'" ) ; throw pe ; } }
gets the value of an enumerated attribute and remove it from the list . enumerated values are case - insensitive .
