001: /*
002: $Header: /cvsroot/xorm/xorm/src/org/xorm/datastore/Column.java,v 1.8 2002/12/10 07:18:29 wbiggs Exp $
003:
004: This file is part of XORM.
005:
006: XORM is free software; you can redistribute it and/or modify
007: it under the terms of the GNU General Public License as published by
008: the Free Software Foundation; either version 2 of the License, or
009: (at your option) any later version.
010:
011: XORM is distributed in the hope that it will be useful,
012: but WITHOUT ANY WARRANTY; without even the implied warranty of
013: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014: GNU General Public License for more details.
015:
016: You should have received a copy of the GNU General Public License
017: along with XORM; if not, write to the Free Software
018: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
019: */
020: package org.xorm.datastore;
021:
022: /**
023: * A column on a table in the datastore.
024: */
025: public class Column {
026: private Table table;
027: private String name;
028: private String sequence;
029: private String type;
030: private String format;
031: private boolean autoIncremented;
032: private boolean readOnly;
033: private boolean nonNull;
034: final int index; // Used for fast lookups for Row
035: boolean managed; // System-managed columns for list indices, etc.
036:
037: public Column(Table table, String name) {
038: this .table = table;
039: this .name = name;
040: this .index = table.addColumn(this );
041: }
042:
043: public Table getTable() {
044: return table;
045: }
046:
047: public String getName() {
048: return name;
049: }
050:
051: public void setName(String name) {
052: this .name = name;
053: }
054:
055: public String getSequence() {
056: return sequence;
057: }
058:
059: public void setSequence(String sequence) {
060: this .sequence = sequence;
061: }
062:
063: public String getType() {
064: return type;
065: }
066:
067: public void setType(String type) {
068: this .type = type;
069: }
070:
071: public String getFormat() {
072: return format;
073: }
074:
075: public void setFormat(String format) {
076: this .format = format;
077: }
078:
079: public boolean isAutoIncremented() {
080: return autoIncremented;
081: }
082:
083: public void setAutoIncremented(boolean autoIncremented) {
084: this .autoIncremented = autoIncremented;
085: }
086:
087: public boolean isReadOnly() {
088: return readOnly;
089: }
090:
091: public void setReadOnly(boolean readOnly) {
092: this .readOnly = readOnly;
093: }
094:
095: public boolean isNonNull() {
096: return nonNull;
097: }
098:
099: public void setNonNull(boolean nonNull) {
100: this .nonNull = nonNull;
101: }
102:
103: public boolean isManaged() {
104: return managed;
105: }
106:
107: public void setManaged(boolean managed) {
108: this .managed = managed;
109: }
110:
111: public String toString() {
112: return getTable().getName() + "." + getName();
113: }
114: }
|