@ SuppressWarnings ( "unchecked" ) public static < V extends NumberVector > NumberVector . Factory < V > guessFactory ( SimpleTypeInformation < V > in ) { NumberVector . Factory < V > factory = null ; if ( in instanceof VectorTypeInformation ) { factory = ( NumberVector . Factory < V > ) ( ( VectorTypeInformation < V > ) in ) . getFactory ( ) ; } if ( factory == null ) { // FIXME: hack. Add factories to simple type information, too? try { Field f = in . getRestrictionClass ( ) . getField ( "FACTORY" ) ; factory = ( NumberVector . Factory < V > ) f . get ( null ) ; } catch ( Exception e ) { LoggingUtil . warning ( "Cannot determine factory for type " + in . getRestrictionClass ( ) , e ) ; } } return factory ; }
Try to guess the appropriate factory .