public < T > DataSource < T > pojoType ( Class < T > pojoType , String ... pojoFields ) { Preconditions . checkNotNull ( pojoType , "The POJO type class must not be null." ) ; Preconditions . checkNotNull ( pojoFields , "POJO fields must be specified (not null) if output type is a POJO." ) ; final TypeInformation < T > ti = TypeExtractor . createTypeInfo ( pojoType ) ; if ( ! ( ti instanceof PojoTypeInfo ) ) { throw new IllegalArgumentException ( "The specified class is not a POJO. The type class must meet the POJO requirements. Found: " + ti ) ; } final PojoTypeInfo < T > pti = ( PojoTypeInfo < T > ) ti ; CsvInputFormat < T > inputFormat = new PojoCsvInputFormat < T > ( path , this . lineDelimiter , this . fieldDelimiter , pti , pojoFields , this . includedMask ) ; configureInputFormat ( inputFormat ) ; return new DataSource < T > ( executionContext , inputFormat , pti , Utils . getCallLocationName ( ) ) ; }
Configures the reader to read the CSV data and parse it to the given type . The all fields of the type must be public or able to set value . The type information for the fields is obtained from the type class .