Class Row

  • All Implemented Interfaces:
    Serializable, Cloneable, Comparable<RowId>

    public final class Row
    extends RowId
    implements Serializable, Cloneable
    The data of a single row in a table (keys/values form a map), or of multiple rows with the same id (values is an array of Serializable).

    The id of the row is distinguished internally from other columns. For fragments corresponding to created data, the initial id is a temporary one, and it will be changed after database insert.

    See Also:
    Serialized Form
    • Field Detail

      • OPAQUE

        public static final Serializable OPAQUE
        A database value we don't care about reading. When present in a fragment, it won't be written, but any other value will be.
      • keys

        protected String[] keys
        The row keys, for single row.
      • size

        protected int size
        The size of the allocated part of values, for single rows.
    • Constructor Detail

      • Row

        public Row​(String tableName,
                   Serializable id)
        Constructs an empty Row for the given table with the given id (may be null).
      • Row

        public Row​(String tableName,
                   Serializable id,
                   Serializable[] array)
        Constructs a new Row from an array of values.
        Parameters:
        array - the initial data to use
    • Method Detail

      • isCollection

        public boolean isCollection()
      • put

        public void put​(String key,
                        Serializable value)
        Puts a key/value. Does not deal with deltas.
        Parameters:
        key - the key
        value - the value
      • put

        public void put​(String key,
                        Serializable value,
                        Serializable[] oldvalues)
        Puts a key/value where the current or new value may be a delta. To resolve a delta, the oldvalues (in-database state) must be consulted.
        Parameters:
        key - the key
        value - the value
        oldvalues - the old values
      • putNew

        public void putNew​(String key,
                           Serializable value)
        Puts a key/value, assuming the key is not already there.
        Parameters:
        key - the key
        value - the value
      • get

        public Serializable get​(String key)
        Gets a value from a key.
        Parameters:
        key - the key
        Returns:
        the value
      • getKeys

        public List<String> getKeys()
        Gets the list of keys. The id is not included.
      • getValues

        public List<Serializable> getValues()
        Gets the list of values. The id is not included.