public < T > Object convert ( Class collectionType , Class < T > elementType , String origin ) throws ConversionException { Converter < T > elementConverter = find ( elementType ) ; CollectionConverter < T > converter = new CollectionConverter <> ( elementConverter , stringSplitter ) ; try { Collection < T > converted = converter . convert ( origin ) ; return castCollectionToType ( collectionType , converted ) ; } catch ( Exception e ) { throw new ConversionException ( String . format ( "Could not convert string <%s> to collection <%s> " + "with element type <%s>" , origin , collectionType , elementType ) , e ) ; } }
Convert given string to specified collection with given element type .