@ SuppressWarnings ( "unchecked" ) < P > void setValues ( T bean , List < String > values ) { Collection < P > col ; try { col = ( Collection < P > ) listType . newInstance ( ) ; } catch ( InstantiationException e ) { throw new RuntimeException ( "Can't instantiate " + listType , e ) ; } catch ( IllegalAccessException e ) { throw new RuntimeException ( "Can't access default constructor of " + listType ) ; } for ( String value : values ) { col . add ( ( P ) converter . fromCharacters ( value ) ) ; } ref . writeValue ( col , bean ) ; }
Write multi value to bean