ingo@230: package de.intevation.gnv.exports;
ingo@230:
ingo@230: /**
ingo@771: * This class is the default implementation of {@link Export.Profile} and
ingo@771: * serves information about the format used to create an export document.
ingo@771: *
ingo@771: * @author Sascha L. Teichmann
ingo@771: * @author Ingo Weinzierl
ingo@230: */
ingo@230: public class DefaultProfile
ingo@230: implements Export.Profile
ingo@230: {
ingo@771: /**
ingo@771: * Used to collect the required data from Result
object.
ingo@771: */
ingo@233: protected Export.DataCollector collector;
ingo@771:
ingo@771: /**
ingo@771: * Column headers.
ingo@771: */
ingo@239: protected String [] header;
ingo@771:
ingo@771: /**
sascha@778: *
ingo@771: */
ingo@233: protected String [] names;
ingo@771:
ingo@771: /**
ingo@771: * Character used to separate columns.
ingo@771: */
ingo@233: protected char separator;
ingo@771:
ingo@771: /**
ingo@771: * Escape character.
ingo@771: */
ingo@233: protected char escapeCharacter;
ingo@771:
ingo@771: /**
ingo@771: * Quote character.
ingo@771: */
ingo@233: protected char quoteCharacter;
ingo@771:
ingo@771: /**
ingo@771: * Format type.
ingo@771: */
ingo@233: protected String type;
ingo@771:
ingo@771: /**
ingo@771: * Encoding used for export.
ingo@771: */
ingo@233: protected String encoding;
ingo@230:
ingo@771: /**
ingo@771: * Constructor
ingo@771: */
ingo@771: private DefaultProfile() {
ingo@230: }
ingo@230:
ingo@771: /**
ingo@771: * Constructor
ingo@771: *
ingo@771: * @param header See {@link #header}
ingo@771: * @param separator See {@link #separator}
ingo@771: * @param escapeCharacter See {@link #escapeCharacter}
ingo@771: * @param quoteCharacter See {@link #quoteCharacter}
ingo@771: * @param type See {@link #type}
ingo@771: * @param encoding See {@link #encoding}
ingo@771: */
ingo@230: public DefaultProfile(
ingo@239: String [] header,
ingo@233: char separator,
ingo@233: char escapeCharacter,
ingo@233: char quoteCharacter,
ingo@233: String type,
ingo@233: String encoding
ingo@230: ) {
ingo@239: this.header = header;
ingo@230: this.separator = separator;
ingo@230: this.escapeCharacter = escapeCharacter;
ingo@230: this.quoteCharacter = quoteCharacter;
ingo@230: this.type = type;
ingo@230: this.encoding = encoding;
ingo@230: }
ingo@230:
ingo@771: /**
ingo@771: * Returns the given value.
ingo@771: *
ingo@771: * @param index Index
ingo@771: * @param value Value
ingo@771: *
ingo@771: * @return value
ingo@771: */
ingo@230: public String toString(int index, String value) {
ingo@230: return value;
ingo@230: }
ingo@230:
ingo@771: /**
ingo@771: * Returns the separator.
ingo@771: *
ingo@771: * @return Separator
ingo@771: */
ingo@230: public char getSeparator() {
ingo@230: return separator;
ingo@230: }
ingo@230:
ingo@771: /**
ingo@771: * Returns the escape character.
ingo@771: *
ingo@771: * @return Escape character
ingo@771: */
ingo@230: public char getEscapeCharacter() {
ingo@230: return escapeCharacter;
ingo@230: }
ingo@230:
ingo@771: /**
ingo@771: * Returns the quote character.
ingo@771: *
ingo@771: * @return Quote character.
ingo@771: */
ingo@230: public char getQuoteCharacter() {
ingo@230: return quoteCharacter;
ingo@230: }
ingo@230:
ingo@771: /**
ingo@771: * Returns the format type.
ingo@771: *
ingo@771: * @return Type.
ingo@771: */
ingo@230: public String getType() {
ingo@230: return type;
ingo@230: }
ingo@230:
ingo@771: /**
ingo@771: * Returns the encoding.
ingo@771: *
ingo@771: * @return Encoding
ingo@771: */
ingo@230: public String getEncoding() {
ingo@230: return encoding;
ingo@230: }
ingo@239:
ingo@771: /**
ingo@771: * Returns the column headers.
ingo@771: *
ingo@771: * @return header
ingo@771: */
ingo@239: public String[] getHeader() {
ingo@239: return header;
ingo@239: }
ingo@230: }
ingo@771: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :