Package mil.nga.geopackage.user
Class UserCoreRow<TColumn extends UserColumn,TTable extends UserTable<TColumn>>
- java.lang.Object
-
- mil.nga.geopackage.user.UserCoreRow<TColumn,TTable>
-
- Type Parameters:
TColumn
- column typeTTable
- table type
public abstract class UserCoreRow<TColumn extends UserColumn,TTable extends UserTable<TColumn>> extends Object
User Row containing the values from a single cursor row- Author:
- osbornb
-
-
Field Summary
Fields Modifier and Type Field Description protected UserColumns<TColumn>
columns
User columnsprotected int[]
columnTypes
Cursor column types of this row, based upon the data valuesprotected TTable
table
User tableprotected Object[]
values
Array of row values
-
Constructor Summary
Constructors Modifier Constructor Description protected
UserCoreRow(UserCoreRow<TColumn,TTable> userCoreRow)
Copy Constructorprotected
UserCoreRow(TTable table)
Constructor to create an empty rowprotected
UserCoreRow(TTable table, UserColumns<TColumn> columns, int[] columnTypes, Object[] values)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
columnCount()
Get the column countprotected Object
copyValue(TColumn column, Object value)
Copy the value of the data typeSet<Map.Entry<String,ColumnValue>>
getAsMap()
Get a MapTColumn
getColumn(int index)
Get the column at the indexTColumn
getColumn(String columnName)
Get the column of the column nameint
getColumnIndex(String columnName)
Get the index of the column nameString
getColumnName(int index)
Get the column name at the indexString[]
getColumnNames()
Get the column namesUserColumns<TColumn>
getColumns()
Get the columnslong
getId()
Get the id value, which is the value of the primary keyTColumn
getPkColumn()
Get the primary key columnint
getPkColumnIndex()
Get the primary key column indexint
getRowColumnType(int index)
Get the Cursor column data type at the indexint
getRowColumnType(String columnName)
Get the Cursor column data type of the column nameint[]
getRowColumnTypes()
Get the row column data typesTTable
getTable()
Get the tableObject
getValue(int index)
Get the value at the indexObject
getValue(String columnName)
Get the value of the column nameObject[]
getValues()
Get the row valuesString
getValueString(int index)
Get the value at the index as a stringString
getValueString(String columnName)
Get the value of the column name as a stringboolean
hasColumn(String columnName)
Check if the row has the columnboolean
hasId()
Check if the row has an id valueboolean
hasIdColumn()
Check if the row has an id columnvoid
resetId()
Clears the id so the row can be used as part of an insert or createvoid
setId(long id)
Set the idvoid
setValue(int index, Object value)
Set the column value at the indexvoid
setValue(String columnName, Object value)
Set the column value of the column nameprotected void
validateValue(TColumn column, Object value, Class<?>... valueTypes)
Validate the value and its actual value types against the column data type class
-
-
-
Field Detail
-
columns
protected final UserColumns<TColumn extends UserColumn> columns
User columns
-
columnTypes
protected final int[] columnTypes
Cursor column types of this row, based upon the data values
-
values
protected final Object[] values
Array of row values
-
-
Constructor Detail
-
UserCoreRow
protected UserCoreRow(TTable table, UserColumns<TColumn> columns, int[] columnTypes, Object[] values)
Constructor- Parameters:
table
- tablecolumns
- columnscolumnTypes
- column typesvalues
- values- Since:
- 3.5.0
-
UserCoreRow
protected UserCoreRow(TTable table)
Constructor to create an empty row- Parameters:
table
- table
-
UserCoreRow
protected UserCoreRow(UserCoreRow<TColumn,TTable> userCoreRow)
Copy Constructor- Parameters:
userCoreRow
- user core row to copy
-
-
Method Detail
-
copyValue
protected Object copyValue(TColumn column, Object value)
Copy the value of the data type- Parameters:
column
- table columnvalue
- value- Returns:
- copy value
-
columnCount
public int columnCount()
Get the column count- Returns:
- column count
-
getAsMap
public Set<Map.Entry<String,ColumnValue>> getAsMap()
Get a Map- Returns:
- a map
- Since:
- 3.0.1
-
getColumnNames
public String[] getColumnNames()
Get the column names- Returns:
- column names
-
getColumnName
public String getColumnName(int index)
Get the column name at the index- Parameters:
index
- index- Returns:
- column name
-
getColumnIndex
public int getColumnIndex(String columnName)
Get the index of the column name- Parameters:
columnName
- column name- Returns:
- column index
-
getValue
public Object getValue(int index)
Get the value at the index- Parameters:
index
- index- Returns:
- value
-
getValue
public Object getValue(String columnName)
Get the value of the column name- Parameters:
columnName
- column name- Returns:
- value
-
getValueString
public String getValueString(int index)
Get the value at the index as a string- Parameters:
index
- index- Returns:
- value
- Since:
- 3.2.0
-
getValueString
public String getValueString(String columnName)
Get the value of the column name as a string- Parameters:
columnName
- column name- Returns:
- value
- Since:
- 3.2.0
-
getValues
public Object[] getValues()
Get the row values- Returns:
- values
-
getRowColumnTypes
public int[] getRowColumnTypes()
Get the row column data types- Returns:
- row column types
-
getRowColumnType
public int getRowColumnType(int index)
Get the Cursor column data type at the index- Parameters:
index
- index- Returns:
- row column type
-
getRowColumnType
public int getRowColumnType(String columnName)
Get the Cursor column data type of the column name- Parameters:
columnName
- column name- Returns:
- row column type
-
getTable
public TTable getTable()
Get the table- Returns:
- table
-
getColumns
public UserColumns<TColumn> getColumns()
Get the columns- Returns:
- columns
- Since:
- 3.5.0
-
getColumn
public TColumn getColumn(int index)
Get the column at the index- Parameters:
index
- 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 row has the column- Parameters:
columnName
- column name- Returns:
- true if has the column
- Since:
- 3.0.1
-
getId
public long getId()
Get the id value, which is the value of the primary key- Returns:
- id
-
hasIdColumn
public boolean hasIdColumn()
Check if the row has an id column- Returns:
- true if has an id column
- Since:
- 3.0.1
-
hasId
public boolean hasId()
Check if the row has an id value- Returns:
- true if has an id
- Since:
- 2.0.0
-
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
-
setValue
public void setValue(int index, Object value)
Set the column value at the index- Parameters:
index
- indexvalue
- value
-
setValue
public void setValue(String columnName, Object value)
Set the column value of the column name- Parameters:
columnName
- column namevalue
- value
-
setId
public void setId(long id)
Set the id- Parameters:
id
- id value- Since:
- 4.0.0
-
resetId
public void resetId()
Clears the id so the row can be used as part of an insert or create
-
-