public SQLUnit toSQL(final TableUnit tableUnit, final Map<String, String> logicAndActualTableMap, final ShardingRule shardingRule, final ShardingDataSourceMetaData shardingDataSourceMetaData) {
        StringBuilder result = new StringBuilder();
        List<Object> insertParameters = new LinkedList<>();
        for (Object each : segments) {
            if (!(each instanceof ShardingPlaceholder)) {
                result.append(each);
                continue;
            }
            String logicTableName = ((ShardingPlaceholder) each).getLogicTableName();
            String actualTableName = logicAndActualTableMap.get(logicTableName);
            if (each instanceof TablePlaceholder) {
                appendTablePlaceholder((TablePlaceholder) each, actualTableName, result);
            } else if (each instanceof SchemaPlaceholder) {
                appendSchemaPlaceholder(shardingRule, shardingDataSourceMetaData, actualTableName, result);
            } else if (each instanceof IndexPlaceholder) {
                appendIndexPlaceholder((IndexPlaceholder) each, actualTableName, result);
            } else if (each instanceof InsertValuesPlaceholder) {
                appendInsertValuesPlaceholder(tableUnit, (InsertValuesPlaceholder) each, insertParameters, result);
            } else {
                result.append(each);
            }
        }
        return insertParameters.isEmpty() ? new SQLUnit(result.toString(), new ArrayList<>(parameters)) : new SQLUnit(result.toString(), insertParameters);
    }
public SQLUnit toSQL ( final TableUnit tableUnit , final Map < String , String > logicAndActualTableMap , final ShardingRule shardingRule , final ShardingDataSourceMetaData shardingDataSourceMetaData ) { StringBuilder result = new StringBuilder ( ) ; List < Object > insertParameters = new LinkedList < > ( ) ; for ( Object each : segments ) { if ( ! ( each instanceof ShardingPlaceholder ) ) { result . append ( each ) ; continue ; } String logicTableName = ( ( ShardingPlaceholder ) each ) . getLogicTableName ( ) ; String actualTableName = logicAndActualTableMap . get ( logicTableName ) ; if ( each instanceof TablePlaceholder ) { appendTablePlaceholder ( ( TablePlaceholder ) each , actualTableName , result ) ; } else if ( each instanceof SchemaPlaceholder ) { appendSchemaPlaceholder ( shardingRule , shardingDataSourceMetaData , actualTableName , result ) ; } else if ( each instanceof IndexPlaceholder ) { appendIndexPlaceholder ( ( IndexPlaceholder ) each , actualTableName , result ) ; } else if ( each instanceof InsertValuesPlaceholder ) { appendInsertValuesPlaceholder ( tableUnit , ( InsertValuesPlaceholder ) each , insertParameters , result ) ; } else { result . append ( each ) ; } } return insertParameters . isEmpty ( ) ? new SQLUnit ( result . toString ( ) , new ArrayList < > ( parameters ) ) : new SQLUnit ( result . toString ( ) , insertParameters ) ; }
Convert to SQL unit.

@param tableUnit table unit
@param logicAndActualTableMap logic and actual map
@param shardingRule sharding rule
@param shardingDataSourceMetaData sharding data source meta data
@return SQL unit