001 002package gudusoft.gsqlparser.pp.stmtformatter.builder.comm; 003 004import gudusoft.gsqlparser.pp.processor.ProcessorFactory; 005import gudusoft.gsqlparser.pp.stmtformatter.builder.AbstractStmtFormatterBuilder; 006import gudusoft.gsqlparser.pp.stmtformatter.type.comm.InsertStmtFormatter; 007import gudusoft.gsqlparser.pp.utils.SourceTokenNameConstant; 008 009public class InsertStmtFormatterBuilder extends 010 AbstractStmtFormatterBuilder<InsertStmtFormatter> 011{ 012 013 @Override 014 protected void initSpecialProcessorForFormatter( 015 InsertStmtFormatter formatter ) 016 { 017 // build the special processor 018 formatter.addSpecialProcessor( ProcessorFactory.createCapitalisationProcessor( getOption( ) ) ); 019 formatter.addSpecialProcessor( ProcessorFactory.createCombineWhitespaceAndClearReturnProcessor( getOption( ) ) ); 020 formatter.addSpecialProcessor( ProcessorFactory.createCTEProcessor( getOption( ), 021 getOption( ).cteNewlineBeforeAs ) ); 022 formatter.addSpecialProcessor( ProcessorFactory.createInsertKeyWordAlignProcessor( getOption( ) ) ); 023 formatter.addSpecialProcessor( ProcessorFactory.createAppendLineAfterInsertTableNameProcessor( getOption( ) ) ); 024 formatter.addSpecialProcessor( ProcessorFactory.createInsertValuesParenthsesAdjustProcessor( getOption( ) ) ); 025 formatter.addSpecialProcessor( ProcessorFactory.createInsertOutputClauseProcessor( getOption( ) ) ); 026 027 // build all the item list processors 028 formatter.addItemListProcessor( ProcessorFactory.createColumnlistCommaProcessor( getOption( ), 029 getOption( ).defaultCommaOption, 030 getOption( ).insertColumnlistStyle ) ); 031 032 // build all the value list processors 033 formatter.addValueListProcessor( ProcessorFactory.createAppendNewLineBeforeReverseKeyWordProcessor( getOption( ), 034 true, 035 SourceTokenNameConstant.VALUES ) ); 036 formatter.addValueListProcessor( ProcessorFactory.createColumnlistCommaProcessor( getOption( ), 037 getOption( ).defaultCommaOption, 038 getOption( ).insertValuelistStyle ) ); 039 } 040 041 @Override 042 protected InsertStmtFormatter newInstanceFormatter( ) 043 { 044 return new InsertStmtFormatter( ); 045 } 046 047}