Class UserCoreRow<TColumn extends UserColumn,​TTable extends UserTable<TColumn>>

  • Type Parameters:
    TColumn - column type
    TTable - 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 Detail

      • 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 - table
        columns - columns
        columnTypes - column types
        values - 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 column
        value - value
        Returns:
        copy value
      • columnCount

        public int columnCount()
        Get the column count
        Returns:
        column count
      • 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 - index
        value - value
      • setValue

        public void setValue​(String columnName,
                             Object value)
        Set the column value of the column name
        Parameters:
        columnName - column name
        value - 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
      • validateValue

        protected void validateValue​(TColumn column,
                                     Object value,
                                     Class<?>... valueTypes)
        Validate the value and its actual value types against the column data type class
        Parameters:
        column - column
        value - value
        valueTypes - value types