Package mil.nga.geopackage.user
Class UserColumn
- java.lang.Object
- 
- mil.nga.geopackage.user.UserColumn
 
- 
- All Implemented Interfaces:
- Comparable<UserColumn>
 - Direct Known Subclasses:
- AttributesColumn,- FeatureColumn,- TileColumn,- UserCustomColumn
 
 public abstract class UserColumn extends Object implements Comparable<UserColumn> Metadata about a single column from a user table- Author:
- osbornb
 
- 
- 
Field SummaryFields Modifier and Type Field Description static intAUTOINCREMENT_CONSTRAINT_ORDERAutoincrement Constraint Orderstatic intDEFAULT_VALUE_CONSTRAINT_ORDERDefault Value Constraint Orderstatic intNO_INDEXUser Column index valuestatic intNOT_NULL_CONSTRAINT_ORDERNot Null Constraint Orderstatic intPRIMARY_KEY_CONSTRAINT_ORDERPrimary Key Constraint Orderstatic intUNIQUE_CONSTRAINT_ORDERUnique Constraint Order
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedUserColumn(int index, String name, String type, GeoPackageDataType dataType, Long max, boolean notNull, Object defaultValue, boolean primaryKey, boolean autoincrement)ConstructorprotectedUserColumn(int index, String name, GeoPackageDataType dataType, Long max, boolean notNull, Object defaultValue, boolean primaryKey, boolean autoincrement)ConstructorprotectedUserColumn(TableColumn tableColumn)ConstructorprotectedUserColumn(UserColumn userColumn)Copy Constructor
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddAutoincrementConstraint()Add an autoincrement constraintvoidaddConstraint(String constraint)Add a constraintvoidaddConstraint(Constraint constraint)Add a constraintvoidaddConstraint(ConstraintType type, Integer order, String constraint)Add a constraintvoidaddConstraint(ConstraintType type, String constraint)Add a constraintvoidaddConstraints(Collection<Constraint> constraints)Add constraintsvoidaddConstraints(ColumnConstraints constraints)Add constraintsvoidaddConstraints(Constraints constraints)Add constraintsvoidaddDefaultConstraints()Add the default constraints that are enabled (not null, default value, primary key) from the column propertiesvoidaddDefaultValueConstraint(Object defaultValue)Add a default value constraintvoidaddNotNullConstraint()Add a not null constraintvoidaddPrimaryKeyConstraint()Add a primary key constraintvoidaddUniqueConstraint()Add a unique constraintStringbuildConstraintSql(Constraint constraint)Build the SQL for the constraintList<Constraint>clearConstraints()Clear the constraintsList<Constraint>clearConstraints(boolean reset)Clear the constraintsList<Constraint>clearConstraints(ConstraintType type)Clear the constraints of the provided typeintcompareTo(UserColumn another)abstract UserColumncopy()Copy the columnConstraintsgetConstraints()Get the constraintsList<Constraint>getConstraints(ConstraintType type)Get the constraints of the provided typeGeoPackageDataTypegetDataType()Get the data typeObjectgetDefaultValue()Get the default valueintgetIndex()Get the indexLonggetMax()Get the maxStringgetName()Get the nameDataColumnsgetSchema()Get the in-memory data columns schema.StringgetType()Get the database typeprotected static StringgetTypeName(String name, GeoPackageDataType dataType)Get the type name from the data typebooleanhasConstraints()Check if has constraintsbooleanhasConstraints(ConstraintType type)Check if has constraints of the provided typebooleanhasDefaultValue()Determine if the column has a default valuebooleanhasIndex()Check if the column has a valid indexbooleanhasMax()Determine if the column has a max valuebooleanhasSchema()Check if the column has an in-memory data columns schemabooleanisAutoincrement()Get the autoincrement flagbooleanisNamed(String name)Determine if this column is named the provided namebooleanisNotNull()Get the is not null flagbooleanisPrimaryKey()Get the primary key flagbooleanisUnique()Get the unique flagvoidremoveAutoincrementConstraint()Remove an autoincrement constraintvoidremoveDefaultValueConstraint()Remove a default value constraintvoidremoveNotNullConstraint()Remove a not null constraintvoidremovePrimaryKeyConstraint()Remove a primary key constraintvoidremoveUniqueConstraint()Remove a unique constraintvoidresetIndex()Reset the column indexvoidsetAutoincrement(boolean autoincrement)Set the autoincrement flagvoidsetConstraintOrder(Constraint constraint)Set the constraint order by constraint typevoidsetDataType(GeoPackageDataType dataType)Set the data typevoidsetDefaultValue(Object defaultValue)Set the default valuevoidsetIndex(int index)Set the column index.voidsetMax(Long max)Set the maxvoidsetName(String name)Set the namevoidsetNotNull(boolean notNull)Set the not null flagvoidsetPrimaryKey(boolean primaryKey)Set the primary key flagvoidsetSchema(DataColumns schema)Set the data columns schema.voidsetType(String type)Set the database typevoidsetUnique(boolean unique)Set the unique flagprotected static voidvalidateDataType(String name, GeoPackageDataType dataType)Validate the data type
 
- 
- 
- 
Field Detail- 
NO_INDEXpublic static final int NO_INDEX User Column index value- Since:
- 3.3.0
- See Also:
- Constant Field Values
 
 - 
NOT_NULL_CONSTRAINT_ORDERpublic static final int NOT_NULL_CONSTRAINT_ORDER Not Null Constraint Order- See Also:
- Constant Field Values
 
 - 
DEFAULT_VALUE_CONSTRAINT_ORDERpublic static final int DEFAULT_VALUE_CONSTRAINT_ORDER Default Value Constraint Order- See Also:
- Constant Field Values
 
 - 
PRIMARY_KEY_CONSTRAINT_ORDERpublic static final int PRIMARY_KEY_CONSTRAINT_ORDER Primary Key Constraint Order- See Also:
- Constant Field Values
 
 - 
AUTOINCREMENT_CONSTRAINT_ORDERpublic static final int AUTOINCREMENT_CONSTRAINT_ORDER Autoincrement Constraint Order- See Also:
- Constant Field Values
 
 - 
UNIQUE_CONSTRAINT_ORDERpublic static final int UNIQUE_CONSTRAINT_ORDER Unique Constraint Order- See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
UserColumnprotected 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
 
 - 
UserColumnprotected 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
 
 - 
UserColumnprotected UserColumn(TableColumn tableColumn) Constructor- Parameters:
- tableColumn- table column
- Since:
- 3.3.0
 
 - 
UserColumnprotected UserColumn(UserColumn userColumn) Copy Constructor- Parameters:
- userColumn- user column
- Since:
- 3.3.0
 
 
- 
 - 
Method Detail- 
getTypeNameprotected 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
 
 - 
validateDataTypeprotected static void validateDataType(String name, GeoPackageDataType dataType) Validate the data type- Parameters:
- name- column name
- dataType- data type
- Since:
- 3.3.0
 
 - 
copypublic abstract UserColumn copy() Copy the column- Returns:
- copied column
- Since:
- 3.3.0
 
 - 
hasIndexpublic boolean hasIndex() Check if the column has a valid index- Returns:
- true if has a valid index
- Since:
- 3.3.0
 
 - 
setIndexpublic void setIndex(int index) Set the column index. Only allowed whenhasIndex()is false (getIndex()isNO_INDEX). Setting a valid index to an existing valid index does nothing.- Parameters:
- index- column index
- Since:
- 3.3.0
 
 - 
resetIndexpublic void resetIndex() Reset the column index- Since:
- 3.3.0
 
 - 
getIndexpublic int getIndex() Get the index- Returns:
- index
 
 - 
setNamepublic void setName(String name) Set the name- Parameters:
- name- column name
- Since:
- 3.3.0
 
 - 
getNamepublic String getName() Get the name- Returns:
- name
 
 - 
isNamedpublic 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
 
 - 
hasMaxpublic boolean hasMax() Determine if the column has a max value- Returns:
- true if has max value
- Since:
- 3.3.0
 
 - 
setMaxpublic void setMax(Long max) Set the max- Parameters:
- max- max
- Since:
- 3.3.0
 
 - 
getMaxpublic Long getMax() Get the max- Returns:
- max
 
 - 
setNotNullpublic void setNotNull(boolean notNull) Set the not null flag- Parameters:
- notNull- not null flag
- Since:
- 3.3.0
 
 - 
isNotNullpublic boolean isNotNull() Get the is not null flag- Returns:
- not null flag
 
 - 
hasDefaultValuepublic boolean hasDefaultValue() Determine if the column has a default value- Returns:
- true if has default value
- Since:
- 3.3.0
 
 - 
setDefaultValuepublic void setDefaultValue(Object defaultValue) Set the default value- Parameters:
- defaultValue- default value
- Since:
- 3.3.0
 
 - 
getDefaultValuepublic Object getDefaultValue() Get the default value- Returns:
- default value
 
 - 
setPrimaryKeypublic void setPrimaryKey(boolean primaryKey) Set the primary key flag- Parameters:
- primaryKey- primary key flag
- Since:
- 3.3.0
 
 - 
isPrimaryKeypublic boolean isPrimaryKey() Get the primary key flag- Returns:
- primary key flag
 
 - 
setAutoincrementpublic void setAutoincrement(boolean autoincrement) Set the autoincrement flag- Parameters:
- autoincrement- autoincrement flag
- Since:
- 4.0.0
 
 - 
isAutoincrementpublic boolean isAutoincrement() Get the autoincrement flag- Returns:
- autoincrement flag
- Since:
- 4.0.0
 
 - 
setUniquepublic void setUnique(boolean unique) Set the unique flag- Parameters:
- unique- unique flag
- Since:
- 5.0.0
 
 - 
isUniquepublic boolean isUnique() Get the unique flag- Returns:
- unique flag
- Since:
- 5.0.0
 
 - 
setDataTypepublic void setDataType(GeoPackageDataType dataType) Set the data type- Parameters:
- dataType- data type
- Since:
- 3.3.0
 
 - 
getDataTypepublic GeoPackageDataType getDataType() Get the data type- Returns:
- data type
 
 - 
setTypepublic void setType(String type) Set the database type- Parameters:
- type- database type
- Since:
- 3.3.0
 
 - 
getTypepublic String getType() Get the database type- Returns:
- type
 
 - 
hasConstraintspublic boolean hasConstraints() Check if has constraints- Returns:
- true if has constraints
- Since:
- 3.3.0
 
 - 
hasConstraintspublic 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
 
 - 
getConstraintspublic Constraints getConstraints() Get the constraints- Returns:
- constraints
- Since:
- 5.0.0
 
 - 
getConstraintspublic List<Constraint> getConstraints(ConstraintType type) Get the constraints of the provided type- Parameters:
- type- constraint type
- Returns:
- constraints
- Since:
- 5.0.0
 
 - 
clearConstraintspublic List<Constraint> clearConstraints() Clear the constraints- Returns:
- cleared constraints
- Since:
- 3.3.0
 
 - 
clearConstraintspublic List<Constraint> clearConstraints(boolean reset) Clear the constraints- Parameters:
- reset- true to reset constraint settings
- Returns:
- cleared constraints
- Since:
- 3.3.0
 
 - 
clearConstraintspublic List<Constraint> clearConstraints(ConstraintType type) Clear the constraints of the provided type- Parameters:
- type- constraint type
- Returns:
- cleared constraints
- Since:
- 5.0.0
 
 - 
addDefaultConstraintspublic void addDefaultConstraints() Add the default constraints that are enabled (not null, default value, primary key) from the column properties- Since:
- 3.3.0
 
 - 
addConstraintpublic void addConstraint(Constraint constraint) Add a constraint- Parameters:
- constraint- constraint
- Since:
- 3.3.0
 
 - 
setConstraintOrderpublic void setConstraintOrder(Constraint constraint) Set the constraint order by constraint type- Parameters:
- constraint- constraint
 
 - 
addConstraintpublic void addConstraint(String constraint) Add a constraint- Parameters:
- constraint- constraint
- Since:
- 3.3.0
 
 - 
addConstraintpublic void addConstraint(ConstraintType type, String constraint) Add a constraint- Parameters:
- type- constraint type
- constraint- constraint
- Since:
- 5.0.0
 
 - 
addConstraintpublic void addConstraint(ConstraintType type, Integer order, String constraint) Add a constraint- Parameters:
- type- constraint type
- order- constraint order
- constraint- constraint
- Since:
- 5.0.0
 
 - 
addConstraintspublic void addConstraints(Collection<Constraint> constraints) Add constraints- Parameters:
- constraints- constraints
- Since:
- 3.3.0
 
 - 
addConstraintspublic void addConstraints(ColumnConstraints constraints) Add constraints- Parameters:
- constraints- constraints
- Since:
- 3.3.0
 
 - 
addConstraintspublic void addConstraints(Constraints constraints) Add constraints- Parameters:
- constraints- constraints
- Since:
- 5.0.0
 
 - 
addNotNullConstraintpublic void addNotNullConstraint() Add a not null constraint- Since:
- 3.3.0
 
 - 
removeNotNullConstraintpublic void removeNotNullConstraint() Remove a not null constraint- Since:
- 5.0.0
 
 - 
addDefaultValueConstraintpublic void addDefaultValueConstraint(Object defaultValue) Add a default value constraint- Parameters:
- defaultValue- default value
- Since:
- 3.3.0
 
 - 
removeDefaultValueConstraintpublic void removeDefaultValueConstraint() Remove a default value constraint- Since:
- 5.0.0
 
 - 
addPrimaryKeyConstraintpublic void addPrimaryKeyConstraint() Add a primary key constraint- Since:
- 3.3.0
 
 - 
removePrimaryKeyConstraintpublic void removePrimaryKeyConstraint() Remove a primary key constraint- Since:
- 5.0.0
 
 - 
addAutoincrementConstraintpublic void addAutoincrementConstraint() Add an autoincrement constraint- Since:
- 4.0.0
 
 - 
removeAutoincrementConstraintpublic void removeAutoincrementConstraint() Remove an autoincrement constraint- Since:
- 5.0.0
 
 - 
addUniqueConstraintpublic void addUniqueConstraint() Add a unique constraint- Since:
- 3.3.0
 
 - 
removeUniqueConstraintpublic void removeUniqueConstraint() Remove a unique constraint- Since:
- 5.0.0
 
 - 
buildConstraintSqlpublic String buildConstraintSql(Constraint constraint) Build the SQL for the constraint- Parameters:
- constraint- constraint
- Returns:
- SQL or null
- Since:
- 4.0.0
 
 - 
getSchemapublic DataColumns getSchema() Get the in-memory data columns schema. Not saved as part of the column, loaded usingDataColumnsDao.- Returns:
- column schema or null
- Since:
- 6.6.7
 
 - 
hasSchemapublic boolean hasSchema() Check if the column has an in-memory data columns schema- Returns:
- true if has column schema
- Since:
- 6.6.7
 
 - 
setSchemapublic void setSchema(DataColumns schema) Set the data columns schema. Not saved as part of the column, saved usingDataColumnsDao.- Parameters:
- schema- data columns schema
- Since:
- 6.6.7
 
 - 
compareTopublic int compareTo(UserColumn another) Sort by index - Specified by:
- compareToin interface- Comparable<UserColumn>
 
 
- 
 
-