Class UserColumn

    • Field Detail

      • NO_INDEX

        public static final int NO_INDEX
        User Column index value
        Since:
        3.3.0
        See Also:
        Constant Field Values
      • NOT_NULL_CONSTRAINT_ORDER

        public static final int NOT_NULL_CONSTRAINT_ORDER
        Not Null Constraint Order
        See Also:
        Constant Field Values
      • DEFAULT_VALUE_CONSTRAINT_ORDER

        public static final int DEFAULT_VALUE_CONSTRAINT_ORDER
        Default Value Constraint Order
        See Also:
        Constant Field Values
      • PRIMARY_KEY_CONSTRAINT_ORDER

        public static final int PRIMARY_KEY_CONSTRAINT_ORDER
        Primary Key Constraint Order
        See Also:
        Constant Field Values
      • AUTOINCREMENT_CONSTRAINT_ORDER

        public static final int AUTOINCREMENT_CONSTRAINT_ORDER
        Autoincrement Constraint Order
        See Also:
        Constant Field Values
      • UNIQUE_CONSTRAINT_ORDER

        public static final int UNIQUE_CONSTRAINT_ORDER
        Unique Constraint Order
        See Also:
        Constant Field Values
    • Constructor Detail

      • UserColumn

        protected UserColumn​(int index,
                             String name,
                             GeoPackageDataType dataType,
                             Long max,
                             boolean notNull,
                             Object defaultValue,
                             boolean primaryKey,
                             boolean autoincrement)
        Constructor
        Parameters:
        index - column index
        name - column name
        dataType - data type
        max - max value
        notNull - not null flag
        defaultValue - default value
        primaryKey - primary key flag
        autoincrement - autoincrement flag
        Since:
        4.0.0
      • UserColumn

        protected UserColumn​(int index,
                             String name,
                             String type,
                             GeoPackageDataType dataType,
                             Long max,
                             boolean notNull,
                             Object defaultValue,
                             boolean primaryKey,
                             boolean autoincrement)
        Constructor
        Parameters:
        index - column index
        name - column name
        type - string type
        dataType - data type
        max - max value
        notNull - not null flag
        defaultValue - default value
        primaryKey - primary key flag
        autoincrement - autoincrement flag
        Since:
        4.0.0
      • UserColumn

        protected UserColumn​(TableColumn tableColumn)
        Constructor
        Parameters:
        tableColumn - table column
        Since:
        3.3.0
      • UserColumn

        protected UserColumn​(UserColumn userColumn)
        Copy Constructor
        Parameters:
        userColumn - user column
        Since:
        3.3.0
    • Method Detail

      • getTypeName

        protected static String getTypeName​(String name,
                                            GeoPackageDataType dataType)
        Get the type name from the data type
        Parameters:
        name - column name
        dataType - data type
        Returns:
        type name
        Since:
        3.3.0
      • validateDataType

        protected static void validateDataType​(String name,
                                               GeoPackageDataType dataType)
        Validate the data type
        Parameters:
        name - column name
        dataType - data type
        Since:
        3.3.0
      • copy

        public abstract UserColumn copy()
        Copy the column
        Returns:
        copied column
        Since:
        3.3.0
      • hasIndex

        public boolean hasIndex()
        Check if the column has a valid index
        Returns:
        true if has a valid index
        Since:
        3.3.0
      • setIndex

        public void setIndex​(int index)
        Set the column index. Only allowed when hasIndex() is false ( getIndex() is NO_INDEX). Setting a valid index to an existing valid index does nothing.
        Parameters:
        index - column index
        Since:
        3.3.0
      • resetIndex

        public void resetIndex()
        Reset the column index
        Since:
        3.3.0
      • getIndex

        public int getIndex()
        Get the index
        Returns:
        index
      • setName

        public void setName​(String name)
        Set the name
        Parameters:
        name - column name
        Since:
        3.3.0
      • getName

        public String getName()
        Get the name
        Returns:
        name
      • isNamed

        public boolean isNamed​(String name)
        Determine if this column is named the provided name
        Parameters:
        name - column name
        Returns:
        true if named the provided name
        Since:
        3.0.1
      • hasMax

        public boolean hasMax()
        Determine if the column has a max value
        Returns:
        true if has max value
        Since:
        3.3.0
      • setMax

        public void setMax​(Long max)
        Set the max
        Parameters:
        max - max
        Since:
        3.3.0
      • getMax

        public Long getMax()
        Get the max
        Returns:
        max
      • setNotNull

        public void setNotNull​(boolean notNull)
        Set the not null flag
        Parameters:
        notNull - not null flag
        Since:
        3.3.0
      • isNotNull

        public boolean isNotNull()
        Get the is not null flag
        Returns:
        not null flag
      • hasDefaultValue

        public boolean hasDefaultValue()
        Determine if the column has a default value
        Returns:
        true if has default value
        Since:
        3.3.0
      • setDefaultValue

        public void setDefaultValue​(Object defaultValue)
        Set the default value
        Parameters:
        defaultValue - default value
        Since:
        3.3.0
      • getDefaultValue

        public Object getDefaultValue()
        Get the default value
        Returns:
        default value
      • setPrimaryKey

        public void setPrimaryKey​(boolean primaryKey)
        Set the primary key flag
        Parameters:
        primaryKey - primary key flag
        Since:
        3.3.0
      • isPrimaryKey

        public boolean isPrimaryKey()
        Get the primary key flag
        Returns:
        primary key flag
      • setAutoincrement

        public void setAutoincrement​(boolean autoincrement)
        Set the autoincrement flag
        Parameters:
        autoincrement - autoincrement flag
        Since:
        4.0.0
      • isAutoincrement

        public boolean isAutoincrement()
        Get the autoincrement flag
        Returns:
        autoincrement flag
        Since:
        4.0.0
      • setUnique

        public void setUnique​(boolean unique)
        Set the unique flag
        Parameters:
        unique - unique flag
        Since:
        5.0.0
      • isUnique

        public boolean isUnique()
        Get the unique flag
        Returns:
        unique flag
        Since:
        5.0.0
      • setDataType

        public void setDataType​(GeoPackageDataType dataType)
        Set the data type
        Parameters:
        dataType - data type
        Since:
        3.3.0
      • getDataType

        public GeoPackageDataType getDataType()
        Get the data type
        Returns:
        data type
      • setType

        public void setType​(String type)
        Set the database type
        Parameters:
        type - database type
        Since:
        3.3.0
      • getType

        public String getType()
        Get the database type
        Returns:
        type
      • hasConstraints

        public boolean hasConstraints()
        Check if has constraints
        Returns:
        true if has constraints
        Since:
        3.3.0
      • hasConstraints

        public boolean hasConstraints​(ConstraintType type)
        Check if has constraints of the provided type
        Parameters:
        type - constraint type
        Returns:
        true if has constraints
        Since:
        5.0.0
      • getConstraints

        public Constraints getConstraints()
        Get the constraints
        Returns:
        constraints
        Since:
        5.0.0
      • getConstraints

        public List<Constraint> getConstraints​(ConstraintType type)
        Get the constraints of the provided type
        Parameters:
        type - constraint type
        Returns:
        constraints
        Since:
        5.0.0
      • clearConstraints

        public List<Constraint> clearConstraints()
        Clear the constraints
        Returns:
        cleared constraints
        Since:
        3.3.0
      • clearConstraints

        public List<Constraint> clearConstraints​(boolean reset)
        Clear the constraints
        Parameters:
        reset - true to reset constraint settings
        Returns:
        cleared constraints
        Since:
        3.3.0
      • clearConstraints

        public List<Constraint> clearConstraints​(ConstraintType type)
        Clear the constraints of the provided type
        Parameters:
        type - constraint type
        Returns:
        cleared constraints
        Since:
        5.0.0
      • addDefaultConstraints

        public void addDefaultConstraints()
        Add the default constraints that are enabled (not null, default value, primary key) from the column properties
        Since:
        3.3.0
      • addConstraint

        public void addConstraint​(Constraint constraint)
        Add a constraint
        Parameters:
        constraint - constraint
        Since:
        3.3.0
      • setConstraintOrder

        public void setConstraintOrder​(Constraint constraint)
        Set the constraint order by constraint type
        Parameters:
        constraint - constraint
      • addConstraint

        public void addConstraint​(String constraint)
        Add a constraint
        Parameters:
        constraint - constraint
        Since:
        3.3.0
      • addConstraint

        public void addConstraint​(ConstraintType type,
                                  String constraint)
        Add a constraint
        Parameters:
        type - constraint type
        constraint - constraint
        Since:
        5.0.0
      • addConstraint

        public void addConstraint​(ConstraintType type,
                                  Integer order,
                                  String constraint)
        Add a constraint
        Parameters:
        type - constraint type
        order - constraint order
        constraint - constraint
        Since:
        5.0.0
      • addConstraints

        public void addConstraints​(Collection<Constraint> constraints)
        Add constraints
        Parameters:
        constraints - constraints
        Since:
        3.3.0
      • addConstraints

        public void addConstraints​(ColumnConstraints constraints)
        Add constraints
        Parameters:
        constraints - constraints
        Since:
        3.3.0
      • addConstraints

        public void addConstraints​(Constraints constraints)
        Add constraints
        Parameters:
        constraints - constraints
        Since:
        5.0.0
      • addNotNullConstraint

        public void addNotNullConstraint()
        Add a not null constraint
        Since:
        3.3.0
      • removeNotNullConstraint

        public void removeNotNullConstraint()
        Remove a not null constraint
        Since:
        5.0.0
      • addDefaultValueConstraint

        public void addDefaultValueConstraint​(Object defaultValue)
        Add a default value constraint
        Parameters:
        defaultValue - default value
        Since:
        3.3.0
      • removeDefaultValueConstraint

        public void removeDefaultValueConstraint()
        Remove a default value constraint
        Since:
        5.0.0
      • addPrimaryKeyConstraint

        public void addPrimaryKeyConstraint()
        Add a primary key constraint
        Since:
        3.3.0
      • removePrimaryKeyConstraint

        public void removePrimaryKeyConstraint()
        Remove a primary key constraint
        Since:
        5.0.0
      • addAutoincrementConstraint

        public void addAutoincrementConstraint()
        Add an autoincrement constraint
        Since:
        4.0.0
      • removeAutoincrementConstraint

        public void removeAutoincrementConstraint()
        Remove an autoincrement constraint
        Since:
        5.0.0
      • addUniqueConstraint

        public void addUniqueConstraint()
        Add a unique constraint
        Since:
        3.3.0
      • removeUniqueConstraint

        public void removeUniqueConstraint()
        Remove a unique constraint
        Since:
        5.0.0
      • buildConstraintSql

        public String buildConstraintSql​(Constraint constraint)
        Build the SQL for the constraint
        Parameters:
        constraint - constraint
        Returns:
        SQL or null
        Since:
        4.0.0
      • getSchema

        public DataColumns getSchema()
        Get the in-memory data columns schema. Not saved as part of the column, loaded using DataColumnsDao.
        Returns:
        column schema or null
        Since:
        6.6.7
      • hasSchema

        public boolean hasSchema()
        Check if the column has an in-memory data columns schema
        Returns:
        true if has column schema
        Since:
        6.6.7
      • setSchema

        public void setSchema​(DataColumns schema)
        Set the data columns schema. Not saved as part of the column, saved using DataColumnsDao.
        Parameters:
        schema - data columns schema
        Since:
        6.6.7