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.PlsqlStmtFormatter; 007import gudusoft.gsqlparser.pp.utils.SourceTokenNameConstant; 008 009public class PlsqlStmtFormatterBuilder extends 010 AbstractStmtFormatterBuilder<PlsqlStmtFormatter> 011{ 012 013 @Override 014 protected void initSpecialProcessorForFormatter( 015 PlsqlStmtFormatter formatter ) 016 { 017 // build the special processor 018 formatter.addSpecialProcessor( ProcessorFactory.createCapitalisationProcessor( getOption( ) ) ); 019 formatter.addSpecialProcessor( ProcessorFactory.createCombineWhitespaceAndClearReturnProcessor( getOption( ) ) ); 020 021 formatter.addSpecialProcessor( ProcessorFactory.createCreateFuncLeftBEProcessor( getOption( ), 022 getOption( ).beStyleFunctionLeftBEOnNewline, 023 getOption( ).beStyleFunctionLeftBEIndentSize ) ); 024 formatter.addSpecialProcessor( ProcessorFactory.createCreateFuncRightBEProcessor( getOption( ), 025 getOption( ).beStyleFunctionRightBEOnNewline, 026 getOption( ).beStyleFunctionRightBEIndentSize ) ); 027 028 formatter.addSpecialProcessor( ProcessorFactory.createCreateFuncFirstParamInNewlineProcessor( getOption( ), 029 getOption( ).beStyleFunctionFirstParamInNewline ) ); 030 031 formatter.addSpecialProcessor( ProcessorFactory.createCreateFuncReturnsTableProcessor( getOption( ) ) ); 032 033 formatter.addSpecialProcessor( ProcessorFactory.createCreateFuncWSPaddingParenthesesProcessor( getOption( ) ) ); 034 035 // build all the item list processors 036 formatter.addParameterProcessor( ProcessorFactory.createColumnlistCommaProcessor( getOption( ), 037 getOption( ).parametersComma, 038 getOption( ).parametersStyle ) ); 039 040 formatter.addParameterProcessor( ProcessorFactory.createAlignAliasProcessor( getOption( ), 041 true, 042 getOption( ).parametersStyle ) ); 043 044 formatter.addDeclareProcessor( ProcessorFactory.createStmtListProcessor( getOption( ), 045 SourceTokenNameConstant.DECLARE ) ); 046 formatter.addBodyProcessor( ProcessorFactory.createStmtListProcessor( getOption( ), 047 SourceTokenNameConstant.BEGIN ) ); 048 049 formatter.addSpecialProcessor( ProcessorFactory.createBeginAndEndProcessor( getOption( ) ) ); 050 051 } 052 053 @Override 054 protected PlsqlStmtFormatter newInstanceFormatter( ) 055 { 056 return new PlsqlStmtFormatter( ); 057 } 058 059}