类 StaxEventItemWriterBuilder<T>
- java.lang.Object
- org.springframework.batch.item.xml.builder.StaxEventItemWriterBuilder<T>
public class StaxEventItemWriterBuilder<T> extends java.lang.Object
A builder for theStaxEventItemWriter
.- 从以下版本开始:
- 4.0
- 作者:
- Michael Minella
- 另请参阅:
StaxEventItemWriter
构造器概要
构造器 构造器 说明 StaxEventItemWriterBuilder()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 StaxEventItemWriter<T>
build()
Returns a configuredStaxEventItemWriter
StaxEventItemWriterBuilder<T>
encoding(java.lang.String encoding)
Encoding for the file.StaxEventItemWriterBuilder<T>
footerCallback(StaxWriterCallback footerCallback)
AStaxWriterCallback
to provide any footer elementsStaxEventItemWriterBuilder<T>
forceSync(boolean forceSync)
Flag to indicate that changes should be force-synced to disk on flush.StaxEventItemWriterBuilder<T>
headerCallback(StaxWriterCallback headerCallback)
AStaxWriterCallback
to provide any header elementsStaxEventItemWriterBuilder<T>
marshaller(org.springframework.oxm.Marshaller marshaller)
TheMarshaller
implementation responsible for the serialization of the items to XML.StaxEventItemWriterBuilder<T>
name(java.lang.String name)
The name used to calculate the key within theExecutionContext
.StaxEventItemWriterBuilder<T>
overwriteOutput(boolean overwriteOutput)
Indicates if an existing file should be overwritten if found.StaxEventItemWriterBuilder<T>
resource(org.springframework.core.io.Resource resource)
TheResource
to be used as output.StaxEventItemWriterBuilder<T>
rootElementAttributes(java.util.Map<java.lang.String,java.lang.String> rootElementAttributes)
A Map of attributes to be included in the document's root element.StaxEventItemWriterBuilder<T>
rootTagName(java.lang.String rootTagName)
The name of the root tag for the output document.StaxEventItemWriterBuilder<T>
saveState(boolean saveState)
Indicates if the state of the writer should be saved in theExecutionContext
.StaxEventItemWriterBuilder<T>
shouldDeleteIfEmpty(boolean shouldDelete)
Flag to indicate that the output file should be deleted if no results were written to it.StaxEventItemWriterBuilder<T>
transactional(boolean transactional)
The resulting writer is participating in a transaction and writes should be delayed as late as possible.StaxEventItemWriterBuilder<T>
version(java.lang.String version)
Version of XML to be generated.
构造器详细资料
StaxEventItemWriterBuilder
public StaxEventItemWriterBuilder()
方法详细资料
name
public StaxEventItemWriterBuilder<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 StaxEventItemWriterBuilder<T> resource(org.springframework.core.io.Resource resource)
TheResource
to be used as output.- 参数:
resource
- the output from the writer- 返回:
- the current instance of the builder.
- 另请参阅:
StaxEventItemWriter.setResource(Resource)
marshaller
public StaxEventItemWriterBuilder<T> marshaller(org.springframework.oxm.Marshaller marshaller)
TheMarshaller
implementation responsible for the serialization of the items to XML. This field is required.- 参数:
marshaller
- the component used to generate XML- 返回:
- the current instance of the builder.
- 另请参阅:
StaxEventItemWriter.setMarshaller(Marshaller)
headerCallback
public StaxEventItemWriterBuilder<T> headerCallback(StaxWriterCallback headerCallback)
AStaxWriterCallback
to provide any header elements- 参数:
headerCallback
- aStaxWriterCallback
- 返回:
- the current instance of the builder.
- 另请参阅:
StaxEventItemWriter.setHeaderCallback(StaxWriterCallback)
footerCallback
public StaxEventItemWriterBuilder<T> footerCallback(StaxWriterCallback footerCallback)
AStaxWriterCallback
to provide any footer elements- 参数:
footerCallback
- aStaxWriterCallback
- 返回:
- the current instance of the builder.
- 另请参阅:
StaxEventItemWriter.setFooterCallback(StaxWriterCallback)
transactional
public StaxEventItemWriterBuilder<T> transactional(boolean transactional)
The resulting writer is participating in a transaction and writes should be delayed as late as possible.- 参数:
transactional
- indicates that the writer is transactional. Defaults to false.- 返回:
- the current instance of the builder
- 另请参阅:
StaxEventItemWriter.setTransactional(boolean)
forceSync
public StaxEventItemWriterBuilder<T> forceSync(boolean forceSync)
Flag to indicate that changes should be force-synced to disk on flush.- 参数:
forceSync
- indicates if force sync should occur. Defaults to false.- 返回:
- the current instance of the builder
- 另请参阅:
StaxEventItemWriter.setForceSync(boolean)
shouldDeleteIfEmpty
public StaxEventItemWriterBuilder<T> shouldDeleteIfEmpty(boolean shouldDelete)
Flag to indicate that the output file should be deleted if no results were written to it. Defaults to false.- 参数:
shouldDelete
- indicator- 返回:
- the current instance of the builder
- 另请参阅:
StaxEventItemWriter.setShouldDeleteIfEmpty(boolean)
encoding
public StaxEventItemWriterBuilder<T> encoding(java.lang.String encoding)
Encoding for the file. Defaults to UTF-8.- 参数:
encoding
- String encoding algorithm- 返回:
- the current instance of the builder
- 另请参阅:
StaxEventItemWriter.setEncoding(String)
version
public StaxEventItemWriterBuilder<T> version(java.lang.String version)
Version of XML to be generated. Must be supported by theMarshaller
provided.- 参数:
version
- XML version- 返回:
- the current instance of the builder
- 另请参阅:
StaxEventItemWriter.version
rootTagName
public StaxEventItemWriterBuilder<T> rootTagName(java.lang.String rootTagName)
The name of the root tag for the output document.- 参数:
rootTagName
- tag name- 返回:
- the current instance of the builder
- 另请参阅:
StaxEventItemWriter.setRootTagName(String)
rootElementAttributes
public StaxEventItemWriterBuilder<T> rootElementAttributes(java.util.Map<java.lang.String,java.lang.String> rootElementAttributes)
A Map of attributes to be included in the document's root element.- 参数:
rootElementAttributes
- map fo attributes- 返回:
- the current instance of the builder.
- 另请参阅:
StaxEventItemWriter.setRootElementAttributes(Map)
overwriteOutput
public StaxEventItemWriterBuilder<T> overwriteOutput(boolean overwriteOutput)
Indicates if an existing file should be overwritten if found. Defaults to true.- 参数:
overwriteOutput
- indicator- 返回:
- the current instance of the builder.
- 另请参阅:
StaxEventItemWriter.setOverwriteOutput(boolean)
saveState
public StaxEventItemWriterBuilder<T> saveState(boolean saveState)
Indicates if the state of the writer should be saved in theExecutionContext
. Setting this to false will impact restartability. Defaults to true.- 参数:
saveState
- indicator- 返回:
- the current instance of the builder
- 另请参阅:
StaxEventItemWriter.setSaveState(boolean)
build
public StaxEventItemWriter<T> build()
Returns a configuredStaxEventItemWriter
- 返回:
- a StaxEventItemWriter