@Override
	public <L extends Collection<E>> L parseCollection(BinderContext context, ParserWrapper parserWrapper, L collection)  throws Exception {
		switch (context.getSupportedFormat()) {
		case XML: {
			throw (new KriptonRuntimeException(context.getSupportedFormat() + " context does not support direct collection persistance"));
		}
		default: {
			JacksonWrapperParser wrapperParser = (JacksonWrapperParser) parserWrapper;
			JsonParser parser = wrapperParser.jacksonParser;

			try {
				collection.clear();

				if (parser.nextToken() != JsonToken.START_ARRAY) {
					throw (new KriptonRuntimeException("Invalid input format"));
				}
				if (context.getSupportedFormat().onlyText) {
					while (parser.nextToken() != JsonToken.END_ARRAY) {
						collection.add(parseOnJacksonAsString(parser));
					}
				} else {
					while (parser.nextToken() != JsonToken.END_ARRAY) {
						collection.add(parseOnJackson(parser));
					}
				}
				return collection;
			} catch (IOException e) {
				e.printStackTrace();
				throw (new KriptonRuntimeException(e));
			}
		}
		}
	}
@ Override public < L extends Collection < E > > L parseCollection ( BinderContext context , ParserWrapper parserWrapper , L collection ) throws Exception { switch ( context . getSupportedFormat ( ) ) { case XML : { throw ( new KriptonRuntimeException ( context . getSupportedFormat ( ) + " context does not support direct collection persistance" ) ) ; } default : { JacksonWrapperParser wrapperParser = ( JacksonWrapperParser ) parserWrapper ; JsonParser parser = wrapperParser . jacksonParser ; try { collection . clear ( ) ; if ( parser . nextToken ( ) != JsonToken . START_ARRAY ) { throw ( new KriptonRuntimeException ( "Invalid input format" ) ) ; } if ( context . getSupportedFormat ( ) . onlyText ) { while ( parser . nextToken ( ) != JsonToken . END_ARRAY ) { collection . add ( parseOnJacksonAsString ( parser ) ) ; } } else { while ( parser . nextToken ( ) != JsonToken . END_ARRAY ) { collection . add ( parseOnJackson ( parser ) ) ; } } return collection ; } catch ( IOException e ) { e . printStackTrace ( ) ; throw ( new KriptonRuntimeException ( e ) ) ; } } } }
/* (non-Javadoc)
@see com.abubusoft.kripton.BinderMapper#parseCollection(com.abubusoft.kripton.BinderContext, com.abubusoft.kripton.persistence.ParserWrapper, java.util.Collection)