/***
 * The MIT License (MIT) 
 * 
 * Copyright (c) 2014 SimonComputing, Inc.
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
package org.batgen;

public class Column {
    /**
     * Flag values are as follows:
     * 
     * bit 1 = required bit 1&2 = key bit 3 = sequence disabled bit 8 = search
     * id
     * 
     */
    public static final int REQUIRED = 1;
    public static final int KEY = 2;
    public static final int SEQUENCE_DISABLED = 4;
    public static final int SEARCH_ID = 8;

    private FieldType type;

    private String fldName;
    private String colName;
    private String comment;

    private Table table;

    private int flags;

    public void setType( FieldType type ) {
        this.type = type;
    };

    public FieldType getType() {
        return type;
    }

    public void setColName( String colName ) {
        this.colName = colName;
    }

    public String getColName() {
        return colName;
    }

    public void setFldName( String fldName ) {
        this.fldName = fldName;
    }

    public String getFldName() {
        return fldName;
    }

    public String getSqlType() {
        return type.getSqlType();
    }

    public String getFldType() {
        if ( type == null )
            throw new IllegalStateException( "type was never assigned for: "
                    + table.getDomName() + "." + colName );

        return isRequired() ? type.getPrimativeType() : type.getWrapperType();
    }

    public void setComment( String comment ) {
        this.comment = comment;
    }

    public String getComments() {
        return comment;
    }

    public void setRequired() {
        flags |= REQUIRED;
    }

    public boolean isRequired() {
        return ( flags & KEY ) != 0;
    }

    public void setKey() {
        flags |= KEY | REQUIRED;
    }

    public boolean isKey() {
        return ( flags & KEY ) != 0;
    }

    public void setSequenceDisabled() {
        flags |= SEQUENCE_DISABLED;
    }

    public boolean isSequenceDisabled() {
        return ( flags & SEQUENCE_DISABLED ) != 0;
    }

    public void setSearchId() {
        flags |= SEARCH_ID;
    }

    public boolean isSearchId() {
        return ( flags & SEARCH_ID ) != 0;
    }

    public void setTable( Table table ) {
        this.table = table;
    }

    public Table getTable() {
        return table;
    }

    @Override
    public String toString() {
        return "Column [fldName=" + fldName + ", colName=" + colName
                + ", fldType=" + getFldType() + ", colType=" + getSqlType()
                + ", comment=" + comment + ", required="
                + isRequired() + ", key=" + isKey() + "searchable=" +isSearchId() +"]";
    }
}

@@ -1226,375 +1226,161 @@
  %7B%0D%0A
-    /**%0D%0A     * Flag values are as follows:%0D%0A     * %0D%0A     * bit 1 = required bit 1&2 = key bit 3 = sequence disabled bit 8 = search%0D%0A     * id%0D%0A     * %0D%0A     */%0D%0A    public static final int REQUIRED = 1;%0D%0A    public static final int KEY = 2;%0D%0A    public static final int SEQUENCE_DISABLED = 4;%0D%0A    public static final int SEARCH_ID = 8;%0D%0A%0D%0A    private FieldType typ
+%0D%0A    private FieldType type;%0D%0A    private String    fldName;%0D%0A    private String    colName;%0D%0A    private String    comment;%0D%0A    private Table     tabl
 e;%0D%0A
@@ -1393,30 +1393,29 @@
 private 
-String fldName
+boolean   key
 ;%0D%0A    p
@@ -1425,84 +1425,69 @@
 ate 
-String colName;%0D%0A    private String comment;%0D%0A%0D%0A    private Table t
+boolean   required;%0D%0A    private boolean   sequenceDis
 able;%0D%0A
-%0D%0A
     
@@ -1498,17 +1498,26 @@
 ate 
-int flags
+boolean   searchId
 ;%0D%0A%0D
@@ -2555,25 +2555,23 @@
     
-flags %7C= REQUIRED
+required = true
 ;%0D%0A 
@@ -2628,36 +2628,24 @@
  return 
-( flags & KEY ) != 0
+required
 ;%0D%0A    %7D
@@ -2688,31 +2688,18 @@
     
-flags %7C= KEY %7C REQUIRED
+key = true
 ;%0D%0A 
@@ -2755,28 +2755,11 @@
 urn 
-( flags & KEY ) != 0
+key
 ;%0D%0A 
@@ -2819,34 +2819,30 @@
     
-flags %7C= SEQUENCE_DISABLED
+sequenceDisable = true
 ;%0D%0A 
@@ -2911,42 +2911,23 @@
 urn 
-( flags & SEQUENCE_DISABLED ) != 0
+sequenceDisable
 ;%0D%0A 
@@ -2979,26 +2979,23 @@
     
-flags %7C= SEARCH_ID
+searchId = true
 ;%0D%0A 
@@ -3056,34 +3056,16 @@
 urn 
-( flags & SEARCH_ID ) != 0
+searchId
 ;%0D%0A 
@@ -3466,16 +3466,31 @@
 quired=%22
+ + isRequired()
 %0D%0A      
@@ -3498,31 +3498,16 @@
         
- + isRequired()
  + %22, ke
@@ -3537,16 +3537,17 @@
 able=%22 +
+ 
 isSearch
@@ -3552,16 +3552,17 @@
 chId() +
+ 
 %22%5D%22;%0D%0A  

Update Column.java