java/sql-dk/src/info/globalcode/sql/dk/formatting/ColumnDescriptor.java
author František Kučera <franta-hg@frantovo.cz>
Mon, 23 Dec 2013 12:16:22 +0100
branchv_0
changeset 39 be8db46a38c3
parent 37 9e6f8e5d5f98
child 174 3c6d560a1d14
permissions -rw-r--r--
TabularFormatter: basic column padding
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     1
/**
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     2
 * SQL-DK
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     3
 * Copyright © 2013 František Kučera (frantovo.cz)
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     4
 *
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     5
 * This program is free software: you can redistribute it and/or modify
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     7
 * the Free Software Foundation, either version 3 of the License, or
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     8
 * (at your option) any later version.
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
     9
 *
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    13
 * GNU General Public License for more details.
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    14
 *
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    16
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    17
 */
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    18
package info.globalcode.sql.dk.formatting;
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    19
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    20
/**
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    21
 *
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    22
 * @author Ing. František Kučera (frantovo.cz)
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    23
 */
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    24
public class ColumnDescriptor {
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    25
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    26
	private String name;
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    27
	private String label;
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    28
	private int type;
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    29
	private String typeName;
37
9e6f8e5d5f98 support SQL commands returning more ResultSets + remove COMMAND_TYPE (type is now derived from result returned from SQL – it is not needed to specify the type on CLI)
František Kučera <franta-hg@frantovo.cz>
parents: 23
diff changeset
    30
	private boolean firstColumn;
9e6f8e5d5f98 support SQL commands returning more ResultSets + remove COMMAND_TYPE (type is now derived from result returned from SQL – it is not needed to specify the type on CLI)
František Kučera <franta-hg@frantovo.cz>
parents: 23
diff changeset
    31
	private boolean lastColumn;
39
be8db46a38c3 TabularFormatter: basic column padding
František Kučera <franta-hg@frantovo.cz>
parents: 37
diff changeset
    32
	private int columnNumber;
23
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    33
37
9e6f8e5d5f98 support SQL commands returning more ResultSets + remove COMMAND_TYPE (type is now derived from result returned from SQL – it is not needed to specify the type on CLI)
František Kučera <franta-hg@frantovo.cz>
parents: 23
diff changeset
    34
	/**
9e6f8e5d5f98 support SQL commands returning more ResultSets + remove COMMAND_TYPE (type is now derived from result returned from SQL – it is not needed to specify the type on CLI)
František Kučera <franta-hg@frantovo.cz>
parents: 23
diff changeset
    35
	 * @return column name
9e6f8e5d5f98 support SQL commands returning more ResultSets + remove COMMAND_TYPE (type is now derived from result returned from SQL – it is not needed to specify the type on CLI)
František Kučera <franta-hg@frantovo.cz>
parents: 23
diff changeset
    36
	 * @see #getLabel()
9e6f8e5d5f98 support SQL commands returning more ResultSets + remove COMMAND_TYPE (type is now derived from result returned from SQL – it is not needed to specify the type on CLI)
František Kučera <franta-hg@frantovo.cz>
parents: 23
diff changeset
    37
	 */
23
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    38
	public String getName() {
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    39
		return name;
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    40
	}
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    41
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    42
	public void setName(String name) {
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    43
		this.name = name;
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    44
	}
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    45
37
9e6f8e5d5f98 support SQL commands returning more ResultSets + remove COMMAND_TYPE (type is now derived from result returned from SQL – it is not needed to specify the type on CLI)
František Kučera <franta-hg@frantovo.cz>
parents: 23
diff changeset
    46
	/**
9e6f8e5d5f98 support SQL commands returning more ResultSets + remove COMMAND_TYPE (type is now derived from result returned from SQL – it is not needed to specify the type on CLI)
František Kučera <franta-hg@frantovo.cz>
parents: 23
diff changeset
    47
	 * @return label specified by the SQL AS clause
9e6f8e5d5f98 support SQL commands returning more ResultSets + remove COMMAND_TYPE (type is now derived from result returned from SQL – it is not needed to specify the type on CLI)
František Kučera <franta-hg@frantovo.cz>
parents: 23
diff changeset
    48
	 */
23
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    49
	public String getLabel() {
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    50
		return label;
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    51
	}
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    52
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    53
	public void setLabel(String label) {
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    54
		this.label = label;
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    55
	}
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    56
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    57
	public int getType() {
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    58
		return type;
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    59
	}
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    60
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    61
	public void setType(int type) {
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    62
		this.type = type;
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    63
	}
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    64
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    65
	public String getTypeName() {
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    66
		return typeName;
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    67
	}
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    68
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    69
	public void setTypeName(String typeName) {
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    70
		this.typeName = typeName;
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    71
	}
37
9e6f8e5d5f98 support SQL commands returning more ResultSets + remove COMMAND_TYPE (type is now derived from result returned from SQL – it is not needed to specify the type on CLI)
František Kučera <franta-hg@frantovo.cz>
parents: 23
diff changeset
    72
9e6f8e5d5f98 support SQL commands returning more ResultSets + remove COMMAND_TYPE (type is now derived from result returned from SQL – it is not needed to specify the type on CLI)
František Kučera <franta-hg@frantovo.cz>
parents: 23
diff changeset
    73
	public boolean isFirstColumn() {
9e6f8e5d5f98 support SQL commands returning more ResultSets + remove COMMAND_TYPE (type is now derived from result returned from SQL – it is not needed to specify the type on CLI)
František Kučera <franta-hg@frantovo.cz>
parents: 23
diff changeset
    74
		return firstColumn;
9e6f8e5d5f98 support SQL commands returning more ResultSets + remove COMMAND_TYPE (type is now derived from result returned from SQL – it is not needed to specify the type on CLI)
František Kučera <franta-hg@frantovo.cz>
parents: 23
diff changeset
    75
	}
9e6f8e5d5f98 support SQL commands returning more ResultSets + remove COMMAND_TYPE (type is now derived from result returned from SQL – it is not needed to specify the type on CLI)
František Kučera <franta-hg@frantovo.cz>
parents: 23
diff changeset
    76
9e6f8e5d5f98 support SQL commands returning more ResultSets + remove COMMAND_TYPE (type is now derived from result returned from SQL – it is not needed to specify the type on CLI)
František Kučera <franta-hg@frantovo.cz>
parents: 23
diff changeset
    77
	public void setFirstColumn(boolean firstColumn) {
9e6f8e5d5f98 support SQL commands returning more ResultSets + remove COMMAND_TYPE (type is now derived from result returned from SQL – it is not needed to specify the type on CLI)
František Kučera <franta-hg@frantovo.cz>
parents: 23
diff changeset
    78
		this.firstColumn = firstColumn;
9e6f8e5d5f98 support SQL commands returning more ResultSets + remove COMMAND_TYPE (type is now derived from result returned from SQL – it is not needed to specify the type on CLI)
František Kučera <franta-hg@frantovo.cz>
parents: 23
diff changeset
    79
	}
9e6f8e5d5f98 support SQL commands returning more ResultSets + remove COMMAND_TYPE (type is now derived from result returned from SQL – it is not needed to specify the type on CLI)
František Kučera <franta-hg@frantovo.cz>
parents: 23
diff changeset
    80
9e6f8e5d5f98 support SQL commands returning more ResultSets + remove COMMAND_TYPE (type is now derived from result returned from SQL – it is not needed to specify the type on CLI)
František Kučera <franta-hg@frantovo.cz>
parents: 23
diff changeset
    81
	public boolean isLastColumn() {
9e6f8e5d5f98 support SQL commands returning more ResultSets + remove COMMAND_TYPE (type is now derived from result returned from SQL – it is not needed to specify the type on CLI)
František Kučera <franta-hg@frantovo.cz>
parents: 23
diff changeset
    82
		return lastColumn;
9e6f8e5d5f98 support SQL commands returning more ResultSets + remove COMMAND_TYPE (type is now derived from result returned from SQL – it is not needed to specify the type on CLI)
František Kučera <franta-hg@frantovo.cz>
parents: 23
diff changeset
    83
	}
9e6f8e5d5f98 support SQL commands returning more ResultSets + remove COMMAND_TYPE (type is now derived from result returned from SQL – it is not needed to specify the type on CLI)
František Kučera <franta-hg@frantovo.cz>
parents: 23
diff changeset
    84
9e6f8e5d5f98 support SQL commands returning more ResultSets + remove COMMAND_TYPE (type is now derived from result returned from SQL – it is not needed to specify the type on CLI)
František Kučera <franta-hg@frantovo.cz>
parents: 23
diff changeset
    85
	public void setLastColumn(boolean lastColumn) {
9e6f8e5d5f98 support SQL commands returning more ResultSets + remove COMMAND_TYPE (type is now derived from result returned from SQL – it is not needed to specify the type on CLI)
František Kučera <franta-hg@frantovo.cz>
parents: 23
diff changeset
    86
		this.lastColumn = lastColumn;
9e6f8e5d5f98 support SQL commands returning more ResultSets + remove COMMAND_TYPE (type is now derived from result returned from SQL – it is not needed to specify the type on CLI)
František Kučera <franta-hg@frantovo.cz>
parents: 23
diff changeset
    87
	}
39
be8db46a38c3 TabularFormatter: basic column padding
František Kučera <franta-hg@frantovo.cz>
parents: 37
diff changeset
    88
be8db46a38c3 TabularFormatter: basic column padding
František Kučera <franta-hg@frantovo.cz>
parents: 37
diff changeset
    89
	/**
be8db46a38c3 TabularFormatter: basic column padding
František Kučera <franta-hg@frantovo.cz>
parents: 37
diff changeset
    90
	 * @return number of this column, 1 = first
be8db46a38c3 TabularFormatter: basic column padding
František Kučera <franta-hg@frantovo.cz>
parents: 37
diff changeset
    91
	 */
be8db46a38c3 TabularFormatter: basic column padding
František Kučera <franta-hg@frantovo.cz>
parents: 37
diff changeset
    92
	public int getColumnNumber() {
be8db46a38c3 TabularFormatter: basic column padding
František Kučera <franta-hg@frantovo.cz>
parents: 37
diff changeset
    93
		return columnNumber;
be8db46a38c3 TabularFormatter: basic column padding
František Kučera <franta-hg@frantovo.cz>
parents: 37
diff changeset
    94
	}
be8db46a38c3 TabularFormatter: basic column padding
František Kučera <franta-hg@frantovo.cz>
parents: 37
diff changeset
    95
be8db46a38c3 TabularFormatter: basic column padding
František Kučera <franta-hg@frantovo.cz>
parents: 37
diff changeset
    96
	public void setColumnNumber(int columnNumber) {
be8db46a38c3 TabularFormatter: basic column padding
František Kučera <franta-hg@frantovo.cz>
parents: 37
diff changeset
    97
		this.columnNumber = columnNumber;
be8db46a38c3 TabularFormatter: basic column padding
František Kučera <franta-hg@frantovo.cz>
parents: 37
diff changeset
    98
	}
23
d8faf91519a5 formatter: ColumnDescriptor
František Kučera <franta-hg@frantovo.cz>
parents:
diff changeset
    99
}