1 package com.quantum.model;
3 import com.quantum.util.sql.TypesHelper;
8 class ColumnImpl implements Column, Comparable {
11 private boolean nullable;
12 private int primaryKeyOrder;
14 private Entity entity;
15 private int numberOfFractionalDigits;
16 private String typeName;
19 private String remarks;
21 ColumnImpl(Entity entity, String name, String typeName, int type,
22 long size, int numberOfFractionalDigits, boolean nullable, int position,
27 this.typeName = typeName;
30 this.numberOfFractionalDigits = numberOfFractionalDigits;
31 this.nullable = nullable;
32 this.position = position;
33 this.remarks = remarks;
37 * @see com.quantum.model.Column#getPrimaryKeyOrder()
39 public int getPrimaryKeyOrder() {
40 return this.primaryKeyOrder;
44 * @see com.quantum.model.Column#isPrimaryKey()
46 public boolean isPrimaryKey() {
47 return getPrimaryKeyOrder() > 0;
51 * @see com.quantum.model.Column#getName()
53 public String getName() {
58 * @see com.quantum.model.Column#getTypeName()
60 public String getTypeName() {
65 * @see com.quantum.model.Column#isReal()
67 public boolean isReal() {
72 * @see com.quantum.model.Column#isNullable()
74 public boolean isNullable() {
79 * @see com.quantum.model.Column#isNumeric()
81 public boolean isNumeric() {
82 return TypesHelper.isNumeric(this.type);
86 * @see com.quantum.model.Column#getType()
88 public int getType() {
93 * @see com.quantum.model.Column#getParentEntity()
95 public Entity getParentEntity() {
100 * @see com.quantum.model.Column#getQualifiedTableName()
102 public String getQualifiedTableName() {
103 return this.entity.getQualifiedName();
108 void setPrimaryKeyOrder(int i) {
109 this.primaryKeyOrder = i;
113 * @see java.lang.Comparable#compareTo(java.lang.Object)
115 public int compareTo(Object o) {
116 ColumnImpl that = (ColumnImpl) o;
117 if (this.isPrimaryKey() && that.isPrimaryKey()) {
118 return this.primaryKeyOrder - that.primaryKeyOrder;
119 } else if (this.isPrimaryKey()) {
121 } else if (that.isPrimaryKey()) {
124 return this.position - that.position;
130 public long getSize() {
137 public int getNumberOfFractionalDigits() {
138 return numberOfFractionalDigits;
144 public String getRemarks() {
145 return this.remarks == null ? "" : this.remarks;