@ Override public String [ ] decode ( long generation , String tableName , List < VoltType > types , List < String > names , String [ ] to , Object [ ] fields ) throws RuntimeException { Preconditions . checkArgument ( fields != null && fields . length > m_firstFieldOffset , "null or inapropriately sized export row array" ) ; /* * Builds a list of string formatters that reflects the row * column types. */ StringFieldDecoder [ ] fieldDecoders ; if ( ! m_fieldDecoders . containsKey ( generation ) ) { int fieldCount = 0 ; Map < String , DecodeType > typeMap = getTypeMap ( generation , types , names ) ; ImmutableList . Builder < StringFieldDecoder > lb = ImmutableList . builder ( ) ; for ( org . voltdb . exportclient . decode . DecodeType dt : typeMap . values ( ) ) { lb . add ( dt . accept ( decodingVisitor , fieldCount ++ , null ) ) ; } fieldDecoders = lb . build ( ) . toArray ( new StringFieldDecoder [ 0 ] ) ; m_fieldDecoders . put ( generation , fieldDecoders ) ; } else { fieldDecoders = m_fieldDecoders . get ( generation ) ; } if ( to == null || to . length < fieldDecoders . length ) { to = new String [ fieldDecoders . length ] ; } for ( int i = m_firstFieldOffset , j = 0 ; i < fields . length && j < fieldDecoders . length ; ++ i , ++ j ) { fieldDecoders [ j ] . decode ( to , fields [ i ] ) ; } return to ; }
Converts an object array containing an exported row values into an array of their string representations