Class CSVDataExporter

    • Constructor Detail

    • Method Detail

      • setDelimiter

        public CSVDataExporter setDelimiter​(char delimiter)
        Sets the delimiter to be used to separate fields. The default delimiter is a colon.
        Parameters:
        delimiter - The delimiter to be used to separate fields.
        Returns:
        this, for chaining.
      • getDelimiter

        public char getDelimiter()
        Returns the delimiter to be used for separating fields.
        Returns:
        the delimiter to be used for separating fields.
      • getCharacterSet

        public String getCharacterSet()
        Returns the character set encoding to be used when exporting data.
        Returns:
        the character set encoding to be used when exporting data.
      • setCharacterSet

        public CSVDataExporter setCharacterSet​(String characterSet)
        Sets the character set encoding to be used when exporting data. This defaults to UTF-8.
        Parameters:
        characterSet - The character set encoding to be used when exporting data.
        Returns:
        this, for chaining.
      • getQuoteCharacter

        public char getQuoteCharacter()
        Returns the character to be used for quoting fields.
        Returns:
        the character to be used for quoting fields.
      • setQuoteCharacter

        public CSVDataExporter setQuoteCharacter​(char quoteCharacter)
        Sets the character to be used to quote fields. This defaults to double quotes,
        Parameters:
        quoteCharacter - The character to be used to quote fields.
        Returns:
        this, for chaining.
      • setExportHeadersEnabled

        public CSVDataExporter setExportHeadersEnabled​(boolean exportHeadersEnabled)
        Turns on or off export headers functionality. If this is set to true, then the first line of the export will contain the column headers. This defaults to true.
        Parameters:
        exportHeadersEnabled - A boolean indicating whether or not headers should be exported.
        Returns:
        this, for chaining.
      • isExportHeadersEnabled

        public boolean isExportHeadersEnabled()
        Indicates if header exporting is enabled. Defaults to true.
        Returns:
        a boolean indicating if header exporting is enabled.
      • quoteValue

        protected String quoteValue​(String value)
        Quotes a value for export to CSV. According to RFC4180, this should just duplicate all occurrences of the quote character and wrap the result in the quote character.
        Parameters:
        value - The value to be quoted.
        Returns:
        a quoted copy of the value.
      • wrapModel

        protected <T> IModel<T> wrapModel​(IModel<T> model)
        Wrap the given model-
        Parameters:
        model -
        Returns: