类 FlatFileItemWriterBuilder<T>
- java.lang.Object
- org.springframework.batch.item.file.builder.FlatFileItemWriterBuilder<T>
public class FlatFileItemWriterBuilder<T> extends java.lang.Object
A builder implementation for theFlatFileItemWriter- 从以下版本开始:
- 4.0
- 作者:
- Michael Minella, Glenn Renfro, Mahmoud Ben Hassine
- 另请参阅:
FlatFileItemWriter
嵌套类概要
嵌套类 修饰符和类型 类 说明 static classFlatFileItemWriterBuilder.DelimitedBuilder<T>A builder for constructing aDelimitedLineAggregatorstatic classFlatFileItemWriterBuilder.FormattedBuilder<T>A builder for constructing aFormatterLineAggregator.
字段概要
字段 修饰符和类型 字段 说明 protected org.apache.commons.logging.Loglogger
构造器概要
构造器 构造器 说明 FlatFileItemWriterBuilder()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 FlatFileItemWriterBuilder<T>append(boolean append)If set to true and the file exists, the output will be appended to the existing file.FlatFileItemWriter<T>build()Validates and builds aFlatFileItemWriter.FlatFileItemWriterBuilder.DelimitedBuilder<T>delimited()Returns an instance of aFlatFileItemWriterBuilder.DelimitedBuilderfor building aDelimitedLineAggregator.FlatFileItemWriterBuilder<T>encoding(java.lang.String encoding)Encoding used for output.FlatFileItemWriterBuilder<T>footerCallback(FlatFileFooterCallback callback)A callback for footer processingFlatFileItemWriterBuilder<T>forceSync(boolean forceSync)A flag indicating that changes should be force-synced to disk on flush.FlatFileItemWriterBuilder.FormattedBuilder<T>formatted()Returns an instance of aFlatFileItemWriterBuilder.FormattedBuilderfor building aFormatterLineAggregator.FlatFileItemWriterBuilder<T>headerCallback(FlatFileHeaderCallback callback)A callback for header processing.FlatFileItemWriterBuilder<T>lineAggregator(LineAggregator<T> lineAggregator)Line aggregator used to build the String version of each item.FlatFileItemWriterBuilder<T>lineSeparator(java.lang.String lineSeparator)String used to separate lines in output.FlatFileItemWriterBuilder<T>name(java.lang.String name)The name used to calculate the key within theExecutionContext.FlatFileItemWriterBuilder<T>resource(org.springframework.core.io.Resource resource)TheResourceto be used as output.FlatFileItemWriterBuilder<T>saveState(boolean saveState)Configure if the state of theItemStreamSupportshould be persisted within theExecutionContextfor restart purposes.FlatFileItemWriterBuilder<T>shouldDeleteIfEmpty(boolean shouldDelete)If set to true, once the step is complete, if the resource previously provided is empty, it will be deleted.FlatFileItemWriterBuilder<T>shouldDeleteIfExists(boolean shouldDelete)If set to true, upon the start of the step, if the resource already exists, it will be deleted and recreated.FlatFileItemWriterBuilder<T>transactional(boolean transactional)If set to true, the flushing of the buffer is delayed while a transaction is active.
字段详细资料
logger
protected org.apache.commons.logging.Log logger
构造器详细资料
FlatFileItemWriterBuilder
public FlatFileItemWriterBuilder()
方法详细资料
saveState
public FlatFileItemWriterBuilder<T> saveState(boolean saveState)
Configure if the state of theItemStreamSupportshould be persisted within theExecutionContextfor restart purposes.- 参数:
saveState- defaults to true- 返回:
- The current instance of the builder.
name
public FlatFileItemWriterBuilder<T> name(java.lang.String name)
The name used to calculate the key within theExecutionContext. Required ifsaveState(boolean)is set to true.- 参数:
name- name of the reader instance- 返回:
- The current instance of the builder.
- 另请参阅:
ItemStreamSupport.setName(String)
resource
public FlatFileItemWriterBuilder<T> resource(org.springframework.core.io.Resource resource)
TheResourceto be used as output.- 参数:
resource- the output of the writer.- 返回:
- The current instance of the builder.
- 另请参阅:
AbstractFileItemWriter.setResource(Resource)
forceSync
public FlatFileItemWriterBuilder<T> forceSync(boolean forceSync)
A flag indicating that changes should be force-synced to disk on flush. Defaults to false.- 参数:
forceSync- value to set the flag to- 返回:
- The current instance of the builder.
- 另请参阅:
AbstractFileItemWriter.setForceSync(boolean)
lineSeparator
public FlatFileItemWriterBuilder<T> lineSeparator(java.lang.String lineSeparator)
String used to separate lines in output. Defaults to the System property line.separator.- 参数:
lineSeparator- value to use for a line separator- 返回:
- The current instance of the builder.
- 另请参阅:
AbstractFileItemWriter.setLineSeparator(String)
lineAggregator
public FlatFileItemWriterBuilder<T> lineAggregator(LineAggregator<T> lineAggregator)
Line aggregator used to build the String version of each item.- 参数:
lineAggregator-LineAggregatorimplementation- 返回:
- The current instance of the builder.
- 另请参阅:
FlatFileItemWriter.setLineAggregator(LineAggregator)
encoding
public FlatFileItemWriterBuilder<T> encoding(java.lang.String encoding)
Encoding used for output.- 参数:
encoding- encoding type.- 返回:
- The current instance of the builder.
- 另请参阅:
AbstractFileItemWriter.setEncoding(String)
shouldDeleteIfEmpty
public FlatFileItemWriterBuilder<T> shouldDeleteIfEmpty(boolean shouldDelete)
If set to true, once the step is complete, if the resource previously provided is empty, it will be deleted.- 参数:
shouldDelete- defaults to false- 返回:
- The current instance of the builder
- 另请参阅:
AbstractFileItemWriter.setShouldDeleteIfEmpty(boolean)
shouldDeleteIfExists
public FlatFileItemWriterBuilder<T> shouldDeleteIfExists(boolean shouldDelete)
If set to true, upon the start of the step, if the resource already exists, it will be deleted and recreated.- 参数:
shouldDelete- defaults to true- 返回:
- The current instance of the builder
- 另请参阅:
AbstractFileItemWriter.setShouldDeleteIfExists(boolean)
append
public FlatFileItemWriterBuilder<T> append(boolean append)
If set to true and the file exists, the output will be appended to the existing file.- 参数:
append- defaults to false- 返回:
- The current instance of the builder
- 另请参阅:
AbstractFileItemWriter.setAppendAllowed(boolean)
headerCallback
public FlatFileItemWriterBuilder<T> headerCallback(FlatFileHeaderCallback callback)
A callback for header processing.- 参数:
callback-FlatFileHeaderCallbackimpl- 返回:
- The current instance of the builder
- 另请参阅:
AbstractFileItemWriter.setHeaderCallback(FlatFileHeaderCallback)
footerCallback
public FlatFileItemWriterBuilder<T> footerCallback(FlatFileFooterCallback callback)
A callback for footer processing- 参数:
callback-FlatFileFooterCallbackimpl- 返回:
- The current instance of the builder
- 另请参阅:
AbstractFileItemWriter.setFooterCallback(FlatFileFooterCallback)
transactional
public FlatFileItemWriterBuilder<T> transactional(boolean transactional)
If set to true, the flushing of the buffer is delayed while a transaction is active.- 参数:
transactional- defaults to true- 返回:
- The current instance of the builder
- 另请参阅:
AbstractFileItemWriter.setTransactional(boolean)
delimited
public FlatFileItemWriterBuilder.DelimitedBuilder<T> delimited()
Returns an instance of aFlatFileItemWriterBuilder.DelimitedBuilderfor building aDelimitedLineAggregator. TheDelimitedLineAggregatorconfigured by this builder will only be used if one is not explicitly configured vialineAggregator
formatted
public FlatFileItemWriterBuilder.FormattedBuilder<T> formatted()
Returns an instance of aFlatFileItemWriterBuilder.FormattedBuilderfor building aFormatterLineAggregator. TheFormatterLineAggregatorconfigured by this builder will only be used if one is not explicitly configured vialineAggregator
build
public FlatFileItemWriter<T> build()
Validates and builds aFlatFileItemWriter.- 返回:
- a
FlatFileItemWriter