com.groupdocs.assembly

Class DocumentAssembler

  • java.lang.Object
    • com.groupdocs.assembly.DocumentAssembler


  • public class DocumentAssembler
    extends java.lang.Object
    Provides routines to populate template documents with data and a set of settings to control these routines.
    • Constructor Summary

      Constructors 
      Constructor and Description
      DocumentAssembler()
      Initializes a new instance of this class.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean assembleDocument(java.io.InputStream sourceStream, java.io.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.
      boolean assembleDocument(java.io.InputStream sourceStream, java.io.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.
      boolean assembleDocument(java.lang.String sourcePath, java.lang.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.
      boolean assembleDocument(java.lang.String sourcePath, java.lang.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.
      BarcodeSettings getBarcodeSettings()
      Gets a set of settings controlling barcode generation while assembling a document.
      KnownTypeSet getKnownTypes()
      Gets an unordered set (that is, a collection of unique items) containing 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.
      int getOptions()
      Gets a set of flags controlling behavior of this DocumentAssembler instance while assembling a document.
      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.
      void setOptions(int value)
      Sets a set of flags controlling behavior of this DocumentAssembler instance while assembling a document.
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DocumentAssembler

        public DocumentAssembler()
        Initializes a new instance of this class.
    • Method Detail

      • assembleDocument

        public boolean assembleDocument(java.lang.String sourcePath,
                                        java.lang.String targetPath,
                                        DataSourceInfo... dataSourceInfos)
                                 throws java.lang.Exception
        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:
        sourcePath - The path to a template document to be populated with data.
        targetPath - The path to a result document.
        dataSourceInfos - Provides information on data source objects to be used.
        Returns:
        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.
        Throws:
        java.lang.Exception
      • assembleDocument

        public boolean assembleDocument(java.lang.String sourcePath,
                                        java.lang.String targetPath,
                                        LoadSaveOptions loadSaveOptions,
                                        DataSourceInfo... dataSourceInfos)
                                 throws java.lang.Exception
        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:
        sourcePath - The path to a template document to be populated with data.
        targetPath - The path to a result document.
        loadSaveOptions - Specifies additional options for document loading and saving.
        dataSourceInfos - Provides information on data source objects to be used.
        Returns:
        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.
        Throws:
        java.lang.Exception
      • assembleDocument

        public boolean assembleDocument(java.io.InputStream sourceStream,
                                        java.io.OutputStream targetStream,
                                        DataSourceInfo... dataSourceInfos)
                                 throws java.lang.Exception
        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:
        sourceStream - The stream to read a template document from.
        targetStream - The stream to write a result document.
        dataSourceInfos - Provides information on data source objects to be used.
        Returns:
        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.
        Throws:
        java.lang.Exception
      • assembleDocument

        public boolean assembleDocument(java.io.InputStream sourceStream,
                                        java.io.OutputStream targetStream,
                                        LoadSaveOptions loadSaveOptions,
                                        DataSourceInfo... dataSourceInfos)
                                 throws java.lang.Exception
        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:
        sourceStream - The stream to read a template document from.
        targetStream - The stream to write a result document.
        loadSaveOptions - Specifies additional options for document loading and saving.
        dataSourceInfos - Provides information on data source objects to be used.
        Returns:
        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.
        Throws:
        java.lang.Exception
      • getOptions

        public int getOptions()
        Gets a set of flags controlling behavior of this DocumentAssembler instance while assembling a document.
        Returns:
        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

        public void setOptions(int value)
        Sets a set of flags controlling behavior of this DocumentAssembler instance while assembling a document.
        Parameters:
        value - 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:
        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 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:
        An unordered set (that is, a collection of unique items) containing 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:
        A value indicating whether invocations of custom type members performed via reflection API are optimized using dynamic class generation or not.
      • setUseReflectionOptimization

        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:
        value - A value indicating whether invocations of custom type members performed via reflection API are optimized using dynamic class generation or not.