Package mil.nga.geopackage.user
Class UserTable<TColumn extends UserColumn>
- java.lang.Object
-
- mil.nga.geopackage.user.UserTable<TColumn>
-
- Type Parameters:
TColumn
- column type
- Direct Known Subclasses:
AttributesTable
,FeatureTable
,TileTable
,UserCustomTable
public abstract class UserTable<TColumn extends UserColumn> extends Object
Abstract user table- Author:
- osbornb
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
DEFAULT_AUTOINCREMENT
Default id autoincrement settingstatic boolean
DEFAULT_PK_NOT_NULL
Default primary key not null setting
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addColumn(TColumn column)
Add a new columnvoid
addConstraint(Constraint constraint)
Add constraintvoid
addConstraints(Collection<Constraint> constraints)
Add constraintsvoid
addConstraints(Constraints constraints)
Add constraintsvoid
alterColumn(TColumn column)
Alter a columnList<Constraint>
clearConstraints()
Clear the constraintsList<Constraint>
clearConstraints(ConstraintType type)
Clear the constraints of the provided typeint
columnCount()
Get the column countList<TColumn>
columnsOfType(GeoPackageDataType type)
Get the columns with the provided data typeabstract UserTable<TColumn>
copy()
Copy the tableUserColumns<TColumn>
createUserColumns(String[] columnNames)
Create user columns for a subset of table columnsabstract UserColumns<TColumn>
createUserColumns(List<TColumn> columns)
Create user columns for a subset of table columnsvoid
dropColumn(int index)
Drop a columnvoid
dropColumn(String columnName)
Drop a columnvoid
dropColumn(TColumn column)
Drop a columnTColumn
getColumn(int index)
Get the column at the indexTColumn
getColumn(String columnName)
Get the column of the column nameint
getColumnIndex(String columnName)
Get the column index of the column nameString
getColumnName(int index)
Get the column name at the indexString[]
getColumnNames()
Get the array of column namesList<TColumn>
getColumns()
Get the list of columnsList<TColumn>
getColumns(String[] columnNames)
Get the columns from the column namesConstraints
getConstraints()
Get the constraintsList<Constraint>
getConstraints(ConstraintType type)
Get the constraints of the provided typeContents
getContents()
Get the contentsabstract String
getDataType()
Get the contents data typeprotected String
getDataType(String defaultType)
Get the contents data type from the contents or use the defaultTColumn
getPkColumn()
Get the primary key columnint
getPkColumnIndex()
Get the primary key column indexString
getPkColumnName()
Get the primary key column nameString
getTableName()
Get the table nameUserColumns<TColumn>
getUserColumns()
Get the user columnsboolean
hasColumn(String columnName)
Check if the table has the columnboolean
hasConstraints()
Check if has constraintsboolean
hasConstraints(ConstraintType type)
Check if has constraints of the provided typeboolean
hasPkColumn()
Check if the table has a primary key columnboolean
hasSchema()
Check if any columns have an in-memory data columns schemaboolean
isPkModifiable()
Is the primary key modifiableboolean
isValueValidation()
Is value validation against column types enabledvoid
renameColumn(int index, String newColumnName)
Rename a columnvoid
renameColumn(String columnName, String newColumnName)
Rename a columnvoid
renameColumn(TColumn column, String newColumnName)
Rename a columnvoid
setContents(Contents contents)
Set the contentsvoid
setPkModifiable(boolean pkModifiable)
Set if the primary key can be modifiedvoid
setTableName(String tableName)
Set the table namevoid
setValueValidation(boolean valueValidation)
Set if values should validated against column typesprotected void
validateContents(Contents contents)
Validate that the set contents are valid
-
-
-
Constructor Detail
-
UserTable
protected UserTable(UserColumns<TColumn> columns)
Constructor- Parameters:
columns
- columns- Since:
- 3.5.0
-
-
Method Detail
-
getDataType
public abstract String getDataType()
Get the contents data type- Returns:
- data type
- Since:
- 3.2.0
-
getDataType
protected String getDataType(String defaultType)
Get the contents data type from the contents or use the default- Parameters:
defaultType
- default data type- Returns:
- contents or default data type
- Since:
- 4.0.0
-
createUserColumns
public abstract UserColumns<TColumn> createUserColumns(List<TColumn> columns)
Create user columns for a subset of table columns- Parameters:
columns
- columns- Returns:
- user columns
- Since:
- 3.5.0
-
createUserColumns
public UserColumns<TColumn> createUserColumns(String[] columnNames)
Create user columns for a subset of table columns- Parameters:
columnNames
- column names- Returns:
- user columns
- Since:
- 3.5.0
-
getUserColumns
public UserColumns<TColumn> getUserColumns()
Get the user columns- Returns:
- user columns
- Since:
- 3.5.0
-
getColumnIndex
public int getColumnIndex(String columnName)
Get the column index of the column name- Parameters:
columnName
- column name- Returns:
- column index
-
getColumnNames
public String[] getColumnNames()
Get the array of column names- Returns:
- column names
-
getColumnName
public String getColumnName(int index)
Get the column name at the index- Parameters:
index
- column index- Returns:
- column name
-
getColumns
public List<TColumn> getColumns(String[] columnNames)
Get the columns from the column names- Parameters:
columnNames
- column names- Returns:
- columns
- Since:
- 3.5.0
-
getColumn
public TColumn getColumn(int index)
Get the column at the index- Parameters:
index
- column index- Returns:
- column
-
getColumn
public TColumn getColumn(String columnName)
Get the column of the column name- Parameters:
columnName
- column name- Returns:
- column
-
hasColumn
public boolean hasColumn(String columnName)
Check if the table has the column- Parameters:
columnName
- column name- Returns:
- true if has the column
- Since:
- 3.0.1
-
columnCount
public int columnCount()
Get the column count- Returns:
- column count
-
getTableName
public String getTableName()
Get the table name- Returns:
- table name
-
setTableName
public void setTableName(String tableName)
Set the table name- Parameters:
tableName
- table name- Since:
- 3.3.0
-
hasPkColumn
public boolean hasPkColumn()
Check if the table has a primary key column- Returns:
- true if has a primary key
- Since:
- 3.0.1
-
getPkColumnIndex
public int getPkColumnIndex()
Get the primary key column index- Returns:
- primary key column index
-
getPkColumn
public TColumn getPkColumn()
Get the primary key column- Returns:
- primary key column
-
getPkColumnName
public String getPkColumnName()
Get the primary key column name- Returns:
- primary key column name
-
addConstraint
public void addConstraint(Constraint constraint)
Add constraint- Parameters:
constraint
- constraint- Since:
- 3.3.0
-
addConstraints
public void addConstraints(Collection<Constraint> 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
-
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:
- 3.3.0
-
clearConstraints
public List<Constraint> clearConstraints()
Clear the constraints- 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
-
columnsOfType
public List<TColumn> columnsOfType(GeoPackageDataType type)
Get the columns with the provided data type- Parameters:
type
- data type- Returns:
- columns
- Since:
- 2.0.0
-
getContents
public Contents getContents()
Get the contents- Returns:
- contents
- Since:
- 3.2.0
-
setContents
public void setContents(Contents contents)
Set the contents- Parameters:
contents
- contents- Since:
- 3.2.0
-
validateContents
protected void validateContents(Contents contents)
Validate that the set contents are valid- Parameters:
contents
- contents
-
isPkModifiable
public boolean isPkModifiable()
Is the primary key modifiable- Returns:
- true if the primary key is modifiable
- Since:
- 4.0.0
-
setPkModifiable
public void setPkModifiable(boolean pkModifiable)
Set if the primary key can be modified- Parameters:
pkModifiable
- primary key modifiable flag- Since:
- 4.0.0
-
isValueValidation
public boolean isValueValidation()
Is value validation against column types enabled- Returns:
- true if values are validated against column types
- Since:
- 4.0.0
-
setValueValidation
public void setValueValidation(boolean valueValidation)
Set if values should validated against column types- Parameters:
valueValidation
- value validation flag- Since:
- 4.0.0
-
addColumn
public void addColumn(TColumn column)
Add a new column- Parameters:
column
- new column- Since:
- 3.3.0
-
renameColumn
public void renameColumn(TColumn column, String newColumnName)
Rename a column- Parameters:
column
- columnnewColumnName
- new column name- Since:
- 3.3.0
-
renameColumn
public void renameColumn(String columnName, String newColumnName)
Rename a column- Parameters:
columnName
- column namenewColumnName
- new column name- Since:
- 3.3.0
-
renameColumn
public void renameColumn(int index, String newColumnName)
Rename a column- Parameters:
index
- column indexnewColumnName
- new column name- Since:
- 3.3.0
-
dropColumn
public void dropColumn(TColumn column)
Drop a column- Parameters:
column
- column to drop- Since:
- 3.3.0
-
dropColumn
public void dropColumn(String columnName)
Drop a column- Parameters:
columnName
- column name- Since:
- 3.3.0
-
dropColumn
public void dropColumn(int index)
Drop a column- Parameters:
index
- column index- Since:
- 3.3.0
-
alterColumn
public void alterColumn(TColumn column)
Alter a column- Parameters:
column
- altered column- Since:
- 3.3.0
-
hasSchema
public boolean hasSchema()
Check if any columns have an in-memory data columns schema- Returns:
- true if has a column schema
- Since:
- 6.6.7
-
-