view gnv-artifacts/src/main/java/de/intevation/gnv/exports/DefaultProfile.java @ 1115:f953c9a559d8

Added license file and license headers. gnv-artifacts/trunk@1260 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 02 Nov 2010 17:46:55 +0000
parents 9a828e5a2390
children
line wrap: on
line source
/*
 * Copyright (c) 2010 by Intevation GmbH
 *
 * This program is free software under the LGPL (>=v2.1)
 * Read the file LGPL.txt coming with the software for details
 * or visit http://www.gnu.org/licenses/ if it does not exist.
 */

package de.intevation.gnv.exports;

/**
 * This class is the default implementation of  {@link Export.Profile} and
 * serves information about the format used to create an export document.
 *
 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
 */
public class DefaultProfile
implements   Export.Profile
{
    /**
     * Used to collect the required data from <code>Result</code> object.
     */
    protected Export.DataCollector collector;

    /**
     * Column headers.
     */
    protected String []            header;

    /**
     *
     */
    protected String []            names;

    /**
     * Character used to separate columns.
     */
    protected char                 separator;

    /**
     * Escape character.
     */
    protected char                 escapeCharacter;

    /**
     * Quote character.
     */
    protected char                 quoteCharacter;

    /**
     * Format type.
     */
    protected String               type;

    /**
     * Encoding used for export.
     */
    protected String               encoding;

    /**
     * Constructor
     */
    private DefaultProfile() {
    }

    /**
     * Constructor
     *
     * @param header See {@link #header}
     * @param separator See {@link #separator}
     * @param escapeCharacter See {@link #escapeCharacter}
     * @param quoteCharacter See {@link #quoteCharacter}
     * @param type See {@link #type}
     * @param encoding See {@link #encoding}
     */
    public DefaultProfile(
        String []            header,
        char                 separator,
        char                 escapeCharacter,
        char                 quoteCharacter,
        String               type,
        String               encoding
    ) {
        this.header          = header;
        this.separator       = separator;
        this.escapeCharacter = escapeCharacter;
        this.quoteCharacter  = quoteCharacter;
        this.type            = type;
        this.encoding        = encoding;
    }

    /**
     * Returns the given value.
     *
     * @param index Index
     * @param value Value
     *
     * @return value
     */
    public String toString(int index, String value) {
        return value;
    }

    /**
     * Returns the separator.
     *
     * @return Separator
     */
    public char getSeparator() {
        return separator;
    }

    /**
     * Returns the escape character.
     *
     * @return Escape character
     */
    public char getEscapeCharacter() {
        return escapeCharacter;
    }

    /**
     * Returns the quote character.
     *
     * @return Quote character.
     */
    public char getQuoteCharacter() {
        return quoteCharacter;
    }

    /**
     * Returns the format type.
     *
     * @return Type.
     */
    public String getType() {
        return type;
    }

    /**
     * Returns the encoding.
     *
     * @return Encoding
     */
    public String getEncoding() {
        return encoding;
    }

    /**
     * Returns the column headers.
     *
     * @return header
     */
    public String[] getHeader() {
        return header;
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org