类 JsonFileItemWriterBuilder<T>
- java.lang.Object
- org.springframework.batch.item.json.builder.JsonFileItemWriterBuilder<T>
- 类型参数:
T
- type of objects to write as Json output.
public class JsonFileItemWriterBuilder<T> extends java.lang.Object
Builder forJsonFileItemWriter
.- 从以下版本开始:
- 4.1
- 作者:
- Mahmoud Ben Hassine
构造器概要
构造器 构造器 说明 JsonFileItemWriterBuilder()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 JsonFileItemWriterBuilder<T>
append(boolean append)
If set to true and the file exists, the output will be appended to the existing file.JsonFileItemWriter<T>
build()
Validate the configuration and build a newJsonFileItemWriter
.JsonFileItemWriterBuilder<T>
encoding(java.lang.String encoding)
Encoding used for output.JsonFileItemWriterBuilder<T>
footerCallback(FlatFileFooterCallback callback)
A callback for footer processing.JsonFileItemWriterBuilder<T>
forceSync(boolean forceSync)
A flag indicating that changes should be force-synced to disk on flush.JsonFileItemWriterBuilder<T>
headerCallback(FlatFileHeaderCallback callback)
A callback for header processing.JsonFileItemWriterBuilder<T>
jsonObjectMarshaller(JsonObjectMarshaller<T> jsonObjectMarshaller)
Set theJsonObjectMarshaller
to use to marshal objects to json.JsonFileItemWriterBuilder<T>
lineSeparator(java.lang.String lineSeparator)
String used to separate lines in output.JsonFileItemWriterBuilder<T>
name(java.lang.String name)
The name used to calculate the key within theExecutionContext
.JsonFileItemWriterBuilder<T>
resource(org.springframework.core.io.Resource resource)
TheResource
to be used as output.JsonFileItemWriterBuilder<T>
saveState(boolean saveState)
Configure if the state of theItemStreamSupport
should be persisted within theExecutionContext
for restart purposes.JsonFileItemWriterBuilder<T>
shouldDeleteIfEmpty(boolean shouldDelete)
If set to true, once the step is complete, if the resource previously provided is empty, it will be deleted.JsonFileItemWriterBuilder<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.JsonFileItemWriterBuilder<T>
transactional(boolean transactional)
If set to true, the flushing of the buffer is delayed while a transaction is active.
构造器详细资料
JsonFileItemWriterBuilder
public JsonFileItemWriterBuilder()
方法详细资料
saveState
public JsonFileItemWriterBuilder<T> saveState(boolean saveState)
Configure if the state of theItemStreamSupport
should be persisted within theExecutionContext
for restart purposes.- 参数:
saveState
- defaults to true- 返回:
- The current instance of the builder.
name
public JsonFileItemWriterBuilder<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)
forceSync
public JsonFileItemWriterBuilder<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 JsonFileItemWriterBuilder<T> lineSeparator(java.lang.String lineSeparator)
String used to separate lines in output. Defaults to the System propertyline.separator
.- 参数:
lineSeparator
- value to use for a line separator- 返回:
- The current instance of the builder.
- 另请参阅:
AbstractFileItemWriter.setLineSeparator(String)
jsonObjectMarshaller
public JsonFileItemWriterBuilder<T> jsonObjectMarshaller(JsonObjectMarshaller<T> jsonObjectMarshaller)
Set theJsonObjectMarshaller
to use to marshal objects to json.- 参数:
jsonObjectMarshaller
- to use- 返回:
- The current instance of the builder.
- 另请参阅:
JsonFileItemWriter.setJsonObjectMarshaller(JsonObjectMarshaller)
resource
public JsonFileItemWriterBuilder<T> resource(org.springframework.core.io.Resource resource)
TheResource
to be used as output.- 参数:
resource
- the output of the writer.- 返回:
- The current instance of the builder.
- 另请参阅:
AbstractFileItemWriter.setResource(Resource)
encoding
public JsonFileItemWriterBuilder<T> encoding(java.lang.String encoding)
Encoding used for output.- 参数:
encoding
- encoding type.- 返回:
- The current instance of the builder.
- 另请参阅:
AbstractFileItemWriter.setEncoding(String)
shouldDeleteIfEmpty
public JsonFileItemWriterBuilder<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 JsonFileItemWriterBuilder<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 JsonFileItemWriterBuilder<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 JsonFileItemWriterBuilder<T> headerCallback(FlatFileHeaderCallback callback)
A callback for header processing.- 参数:
callback
-FlatFileHeaderCallback
implementation- 返回:
- The current instance of the builder
- 另请参阅:
AbstractFileItemWriter.setHeaderCallback(FlatFileHeaderCallback)
footerCallback
public JsonFileItemWriterBuilder<T> footerCallback(FlatFileFooterCallback callback)
A callback for footer processing.- 参数:
callback
-FlatFileFooterCallback
implementation- 返回:
- The current instance of the builder
- 另请参阅:
AbstractFileItemWriter.setFooterCallback(FlatFileFooterCallback)
transactional
public JsonFileItemWriterBuilder<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)
build
public JsonFileItemWriter<T> build()
Validate the configuration and build a newJsonFileItemWriter
.- 返回:
- a new instance of the
JsonFileItemWriter