public static <T extends Enum<T>>List<T> parserEnumList(JsonPullParser parser, Class<T> clazz)
			throws IOException, JsonFormatException {

		State eventType = parser.getEventType();
		if (eventType == State.VALUE_NULL) {
			return null;
		}
		if (eventType != State.START_ARRAY) {
			throw new IllegalStateException("not started brace!");
		}
		List<T> list = new ArrayList<T>();
		while (parser.lookAhead() != State.END_ARRAY) {
			eventType = parser.getEventType();
			if (eventType == State.VALUE_NULL) {
				list.add(null);
			} else if (eventType == State.VALUE_STRING) {
				T obj = Enum.valueOf(clazz, parser.getValueString());
				list.add(obj);
			} else {
				throw new IllegalStateException("unexpected state. expected=VALUE_STRING, but get="
						+ eventType.toString());
			}
		}
		parser.getEventType();
		return list;
	}
public static < T extends Enum < T > > List < T > parserEnumList ( JsonPullParser parser , Class < T > clazz ) throws IOException , JsonFormatException { State eventType = parser . getEventType ( ) ; if ( eventType == State . VALUE_NULL ) { return null ; } if ( eventType != State . START_ARRAY ) { throw new IllegalStateException ( "not started brace!" ) ; } List < T > list = new ArrayList < T > ( ) ; while ( parser . lookAhead ( ) != State . END_ARRAY ) { eventType = parser . getEventType ( ) ; if ( eventType == State . VALUE_NULL ) { list . add ( null ) ; } else if ( eventType == State . VALUE_STRING ) { T obj = Enum . valueOf ( clazz , parser . getValueString ( ) ) ; list . add ( obj ) ; } else { throw new IllegalStateException ( "unexpected state. expected=VALUE_STRING, but get=" + eventType . toString ( ) ) ; } } parser . getEventType ( ) ; return list ; }
Parses the current token as a list of Enums.
@param <T>
@param parser
@param clazz
@return List of {@link Enum}s
@throws IOException
@throws JsonFormatException
@author vvakame