DocumentAssembler

Inheritance: java.lang.Object

public class DocumentAssembler

Provides routines to populate template documents with data and a set of settings to control these routines.

Constructors

Constructor Description
DocumentAssembler() Initializes a new instance of this class.

Methods

Method Description
assembleDocument(String sourcePath, String targetPath, DataSourceInfo[] dataSourceInfos) Loads a template document from the specified source path, populates the template document with data from the specified single or multiple sources, and stores the result document to the target path using default LoadSaveOptions.
assembleDocument(String sourcePath, String targetPath, LoadSaveOptions loadSaveOptions, DataSourceInfo[] dataSourceInfos) Loads a template document from the specified source path, populates the template document with data from the specified single or multiple sources, and stores the result document to the target path using the given LoadSaveOptions.
assembleDocument(InputStream sourceStream, OutputStream targetStream, DataSourceInfo[] dataSourceInfos) Loads a template document from the specified source stream, populates the template document with data from the specified single or multiple sources, and stores the result document to the target stream using default LoadSaveOptions.
assembleDocument(InputStream sourceStream, OutputStream targetStream, LoadSaveOptions loadSaveOptions, DataSourceInfo[] dataSourceInfos) Loads a template document from the specified source stream, populates the template document with data from the specified single or multiple sources, and stores the result document to the target stream using the given LoadSaveOptions.
getOptions() Gets a set of flags controlling behavior of this DocumentAssembler instance while assembling a document.
setOptions(int value) Sets a set of flags controlling behavior of this DocumentAssembler instance while assembling a document.
getBarcodeSettings() Gets a set of settings controlling barcode generation while assembling a document.
getKnownTypes() Gets an unordered set (that is, a collection of unique items) containing java.lang.Class objects which fully or partially qualified names can be used within document templates processed by this assembler instance to invoke the corresponding types’ static members, perform type casts, etc.
getUseReflectionOptimization() Gets a value indicating whether invocations of custom type members performed via reflection API are optimized using dynamic class generation or not.
setUseReflectionOptimization(boolean value) Sets a value indicating whether invocations of custom type members performed via reflection API are optimized using dynamic class generation or not.

DocumentAssembler()

public DocumentAssembler()

Initializes a new instance of this class.

assembleDocument(String sourcePath, String targetPath, DataSourceInfo[] dataSourceInfos)

public boolean assembleDocument(String sourcePath, String targetPath, DataSourceInfo[] dataSourceInfos)

Loads a template document from the specified source path, populates the template document with data from the specified single or multiple sources, and stores the result document to the target path using default LoadSaveOptions.

Parameters:

Parameter Type Description
sourcePath java.lang.String The path to a template document to be populated with data.
targetPath java.lang.String The path to a result document.
dataSourceInfos DataSourceInfo[] Provides information on data source objects to be used.

Returns: boolean - A flag indicating whether parsing of the template document was successful. The returned flag makes sense only if a value of the getOptions() / setOptions(int) property includes the DocumentAssemblyOptions.INLINE_ERROR_MESSAGES option.

assembleDocument(String sourcePath, String targetPath, LoadSaveOptions loadSaveOptions, DataSourceInfo[] dataSourceInfos)

public boolean assembleDocument(String sourcePath, String targetPath, LoadSaveOptions loadSaveOptions, DataSourceInfo[] dataSourceInfos)

Loads a template document from the specified source path, populates the template document with data from the specified single or multiple sources, and stores the result document to the target path using the given LoadSaveOptions.

Parameters:

Parameter Type Description
sourcePath java.lang.String The path to a template document to be populated with data.
targetPath java.lang.String The path to a result document.
loadSaveOptions LoadSaveOptions Specifies additional options for document loading and saving.
dataSourceInfos DataSourceInfo[] Provides information on data source objects to be used.

Returns: boolean - A flag indicating whether parsing of the template document was successful. The returned flag makes sense only if a value of the getOptions() / setOptions(int) property includes the DocumentAssemblyOptions.INLINE_ERROR_MESSAGES option.

assembleDocument(InputStream sourceStream, OutputStream targetStream, DataSourceInfo[] dataSourceInfos)

public boolean assembleDocument(InputStream sourceStream, OutputStream targetStream, DataSourceInfo[] dataSourceInfos)

Loads a template document from the specified source stream, populates the template document with data from the specified single or multiple sources, and stores the result document to the target stream using default LoadSaveOptions.

Parameters:

Parameter Type Description
sourceStream java.io.InputStream The stream to read a template document from.
targetStream java.io.OutputStream The stream to write a result document.
dataSourceInfos DataSourceInfo[] Provides information on data source objects to be used.

Returns: boolean - A flag indicating whether parsing of the template document was successful. The returned flag makes sense only if a value of the getOptions() / setOptions(int) property includes the DocumentAssemblyOptions.INLINE_ERROR_MESSAGES option.

assembleDocument(InputStream sourceStream, OutputStream targetStream, LoadSaveOptions loadSaveOptions, DataSourceInfo[] dataSourceInfos)

public boolean assembleDocument(InputStream sourceStream, OutputStream targetStream, LoadSaveOptions loadSaveOptions, DataSourceInfo[] dataSourceInfos)

Loads a template document from the specified source stream, populates the template document with data from the specified single or multiple sources, and stores the result document to the target stream using the given LoadSaveOptions.

Parameters:

Parameter Type Description
sourceStream java.io.InputStream The stream to read a template document from.
targetStream java.io.OutputStream The stream to write a result document.
loadSaveOptions LoadSaveOptions Specifies additional options for document loading and saving.
dataSourceInfos DataSourceInfo[] Provides information on data source objects to be used.

Returns: boolean - A flag indicating whether parsing of the template document was successful. The returned flag makes sense only if a value of the getOptions() / setOptions(int) property includes the DocumentAssemblyOptions.INLINE_ERROR_MESSAGES option.

getOptions()

public int getOptions()

Gets a set of flags controlling behavior of this DocumentAssembler instance while assembling a document.

Returns: int - A set of flags controlling behavior of this DocumentAssembler instance while assembling a document. The returned value is a bitwise combination of DocumentAssemblyOptions constants.

setOptions(int value)

public void setOptions(int value)

Sets a set of flags controlling behavior of this DocumentAssembler instance while assembling a document.

Parameters:

Parameter Type Description
value int A set of flags controlling behavior of this DocumentAssembler instance while assembling a document. The value must be a bitwise combination of DocumentAssemblyOptions constants.

getBarcodeSettings()

public BarcodeSettings getBarcodeSettings()

Gets a set of settings controlling barcode generation while assembling a document.

Returns: BarcodeSettings - A set of settings controlling barcode generation while assembling a document.

getKnownTypes()

public KnownTypeSet getKnownTypes()

Gets an unordered set (that is, a collection of unique items) containing java.lang.Class objects which fully or partially qualified names can be used within document templates processed by this assembler instance to invoke the corresponding types’ static members, perform type casts, etc.

Returns: KnownTypeSet - An unordered set (that is, a collection of unique items) containing java.lang.Class objects which fully or partially qualified names can be used within document templates processed by this assembler instance to invoke the corresponding types’ static members, perform type casts, etc.

getUseReflectionOptimization()

public static boolean getUseReflectionOptimization()

Gets a value indicating whether invocations of custom type members performed via reflection API are optimized using dynamic class generation or not. The default value is true. There are some scenarios where it is preferrable to disable this optimization. For example, if you are dealing with small collections of data items all the time, then an overhead of dynamic class generation can be more noticeable than an overhead of direct reflection API calls.

Returns: boolean - A value indicating whether invocations of custom type members performed via reflection API are optimized using dynamic class generation or not.

setUseReflectionOptimization(boolean value)

public static void setUseReflectionOptimization(boolean value)

Sets a value indicating whether invocations of custom type members performed via reflection API are optimized using dynamic class generation or not. The default value is true. There are some scenarios where it is preferrable to disable this optimization. For example, if you are dealing with small collections of data items all the time, then an overhead of dynamic class generation can be more noticeable than an overhead of direct reflection API calls.

Parameters:

Parameter Type Description
value boolean A value indicating whether invocations of custom type members performed via reflection API are optimized using dynamic class generation or not.