public abstract class UserColumn extends Object implements Comparable<UserColumn>
| Modifier and Type | Field and Description |
|---|---|
static int |
AUTOINCREMENT_CONSTRAINT_ORDER
Autoincrement Constraint Order
|
static int |
DEFAULT_VALUE_CONSTRAINT_ORDER
Default Value Constraint Order
|
static int |
NO_INDEX
User Column index value
|
static int |
NOT_NULL_CONSTRAINT_ORDER
Not Null Constraint Order
|
static int |
PRIMARY_KEY_CONSTRAINT_ORDER
Primary Key Constraint Order
|
static int |
UNIQUE_CONSTRAINT_ORDER
Unique Constraint Order
|
| Modifier | Constructor and Description |
|---|---|
protected |
UserColumn(int index,
String name,
GeoPackageDataType dataType,
Long max,
boolean notNull,
Object defaultValue,
boolean primaryKey,
boolean autoincrement)
Constructor
|
protected |
UserColumn(int index,
String name,
String type,
GeoPackageDataType dataType,
Long max,
boolean notNull,
Object defaultValue,
boolean primaryKey,
boolean autoincrement)
Constructor
|
protected |
UserColumn(TableColumn tableColumn)
Constructor
|
protected |
UserColumn(UserColumn userColumn)
Copy Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAutoincrementConstraint()
Add an autoincrement constraint
|
void |
addConstraint(Constraint constraint)
Add a constraint
|
void |
addConstraint(ConstraintType type,
Integer order,
String constraint)
Add a constraint
|
void |
addConstraint(ConstraintType type,
String constraint)
Add a constraint
|
void |
addConstraint(String constraint)
Add a constraint
|
void |
addConstraints(Collection<Constraint> constraints)
Add constraints
|
void |
addConstraints(ColumnConstraints constraints)
Add constraints
|
void |
addConstraints(Constraints constraints)
Add constraints
|
void |
addDefaultConstraints()
Add the default constraints that are enabled (not null, default value,
primary key) from the column properties
|
void |
addDefaultValueConstraint(Object defaultValue)
Add a default value constraint
|
void |
addNotNullConstraint()
Add a not null constraint
|
void |
addPrimaryKeyConstraint()
Add a primary key constraint
|
void |
addUniqueConstraint()
Add a unique constraint
|
String |
buildConstraintSql(Constraint constraint)
Build the SQL for the constraint
|
List<Constraint> |
clearConstraints()
Clear the constraints
|
List<Constraint> |
clearConstraints(boolean reset)
Clear the constraints
|
List<Constraint> |
clearConstraints(ConstraintType type)
Clear the constraints of the provided type
|
int |
compareTo(UserColumn another)
Sort by index
|
abstract UserColumn |
copy()
Copy the column
|
Constraints |
getConstraints()
Get the constraints
|
List<Constraint> |
getConstraints(ConstraintType type)
Get the constraints of the provided type
|
GeoPackageDataType |
getDataType()
Get the data type
|
Object |
getDefaultValue()
Get the default value
|
int |
getIndex()
Get the index
|
Long |
getMax()
Get the max
|
String |
getName()
Get the name
|
String |
getType()
Get the database type
|
protected static String |
getTypeName(String name,
GeoPackageDataType dataType)
Get the type name from the data type
|
boolean |
hasConstraints()
Check if has constraints
|
boolean |
hasConstraints(ConstraintType type)
Check if has constraints of the provided type
|
boolean |
hasDefaultValue()
Determine if the column has a default value
|
boolean |
hasIndex()
Check if the column has a valid index
|
boolean |
hasMax()
Determine if the column has a max value
|
boolean |
isAutoincrement()
Get the autoincrement flag
|
boolean |
isNamed(String name)
Determine if this column is named the provided name
|
boolean |
isNotNull()
Get the is not null flag
|
boolean |
isPrimaryKey()
Get the primary key flag
|
boolean |
isUnique()
Get the unique flag
|
void |
removeAutoincrementConstraint()
Remove an autoincrement constraint
|
void |
removeDefaultValueConstraint()
Remove a default value constraint
|
void |
removeNotNullConstraint()
Remove a not null constraint
|
void |
removePrimaryKeyConstraint()
Remove a primary key constraint
|
void |
removeUniqueConstraint()
Remove a unique constraint
|
void |
resetIndex()
Reset the column index
|
void |
setAutoincrement(boolean autoincrement)
Set the autoincrement flag
|
void |
setConstraintOrder(Constraint constraint)
Set the constraint order by constraint type
|
void |
setDataType(GeoPackageDataType dataType)
Set the data type
|
void |
setDefaultValue(Object defaultValue)
Set the default value
|
void |
setIndex(int index)
Set the column index.
|
void |
setMax(Long max)
Set the max
|
void |
setName(String name)
Set the name
|
void |
setNotNull(boolean notNull)
Set the not null flag
|
void |
setPrimaryKey(boolean primaryKey)
Set the primary key flag
|
void |
setType(String type)
Set the database type
|
void |
setUnique(boolean unique)
Set the unique flag
|
protected static void |
validateDataType(String name,
GeoPackageDataType dataType)
Validate the data type
|
public static final int NO_INDEX
public static final int NOT_NULL_CONSTRAINT_ORDER
public static final int DEFAULT_VALUE_CONSTRAINT_ORDER
public static final int PRIMARY_KEY_CONSTRAINT_ORDER
public static final int AUTOINCREMENT_CONSTRAINT_ORDER
public static final int UNIQUE_CONSTRAINT_ORDER
protected UserColumn(int index,
String name,
GeoPackageDataType dataType,
Long max,
boolean notNull,
Object defaultValue,
boolean primaryKey,
boolean autoincrement)
index - column indexname - column namedataType - data typemax - max valuenotNull - not null flagdefaultValue - default valueprimaryKey - primary key flagautoincrement - autoincrement flagprotected UserColumn(int index,
String name,
String type,
GeoPackageDataType dataType,
Long max,
boolean notNull,
Object defaultValue,
boolean primaryKey,
boolean autoincrement)
index - column indexname - column nametype - string typedataType - data typemax - max valuenotNull - not null flagdefaultValue - default valueprimaryKey - primary key flagautoincrement - autoincrement flagprotected UserColumn(TableColumn tableColumn)
tableColumn - table columnprotected UserColumn(UserColumn userColumn)
userColumn - user columnprotected static String getTypeName(String name, GeoPackageDataType dataType)
name - column namedataType - data typeprotected static void validateDataType(String name, GeoPackageDataType dataType)
name - column namedataType - data typepublic abstract UserColumn copy()
public boolean hasIndex()
public void setIndex(int index)
hasIndex() is false (
getIndex() is NO_INDEX). Setting a valid index to an
existing valid index does nothing.index - column indexpublic void resetIndex()
public int getIndex()
public void setName(String name)
name - column namepublic String getName()
public boolean isNamed(String name)
name - column namepublic boolean hasMax()
public void setMax(Long max)
max - maxpublic Long getMax()
public void setNotNull(boolean notNull)
notNull - not null flagpublic boolean isNotNull()
public boolean hasDefaultValue()
public void setDefaultValue(Object defaultValue)
defaultValue - default valuepublic Object getDefaultValue()
public void setPrimaryKey(boolean primaryKey)
primaryKey - primary key flagpublic boolean isPrimaryKey()
public void setAutoincrement(boolean autoincrement)
autoincrement - autoincrement flagpublic boolean isAutoincrement()
public void setUnique(boolean unique)
unique - unique flagpublic boolean isUnique()
public void setDataType(GeoPackageDataType dataType)
dataType - data typepublic GeoPackageDataType getDataType()
public void setType(String type)
type - database typepublic String getType()
public boolean hasConstraints()
public boolean hasConstraints(ConstraintType type)
type - constraint typepublic Constraints getConstraints()
public List<Constraint> getConstraints(ConstraintType type)
type - constraint typepublic List<Constraint> clearConstraints()
public List<Constraint> clearConstraints(boolean reset)
reset - true to reset constraint settingspublic List<Constraint> clearConstraints(ConstraintType type)
type - constraint typepublic void addDefaultConstraints()
public void addConstraint(Constraint constraint)
constraint - constraintpublic void setConstraintOrder(Constraint constraint)
constraint - constraintpublic void addConstraint(String constraint)
constraint - constraintpublic void addConstraint(ConstraintType type, String constraint)
type - constraint typeconstraint - constraintpublic void addConstraint(ConstraintType type, Integer order, String constraint)
type - constraint typeorder - constraint orderconstraint - constraintpublic void addConstraints(Collection<Constraint> constraints)
constraints - constraintspublic void addConstraints(ColumnConstraints constraints)
constraints - constraintspublic void addConstraints(Constraints constraints)
constraints - constraintspublic void addNotNullConstraint()
public void removeNotNullConstraint()
public void addDefaultValueConstraint(Object defaultValue)
defaultValue - default valuepublic void removeDefaultValueConstraint()
public void addPrimaryKeyConstraint()
public void removePrimaryKeyConstraint()
public void addAutoincrementConstraint()
public void removeAutoincrementConstraint()
public void addUniqueConstraint()
public void removeUniqueConstraint()
public String buildConstraintSql(Constraint constraint)
constraint - constraintpublic int compareTo(UserColumn another)
compareTo in interface Comparable<UserColumn>Copyright © 2021 National Geospatial-Intelligence Agency. All rights reserved.