Interface Table<R>

All Superinterfaces:
AutoCloseable, Closeable

public interface Table<R> extends Closeable
Defines a relational collection of persistent rows. A row is defined by an interface consisting of accessor/mutator methods corresponding to each column:
@PrimaryKey("id")
public interface MyRow {
    long id();
    void id(long id);

    String name();
    void name(String str);

    String message();
    void message(String str);
}

Supported column types:

  • Simple objects — String, BigInteger, and BigDecimal
  • Primitives — int, double, etc
  • Boxed primitives — Integer, Double, etc
  • Primitive arrays — int[], double[], etc
By default, object columns cannot be set to null, and attempting to do so causes an IllegalArgumentException to be thrown. The column definition must be annotated with @Nullable to support nulls.

The actual row implementation class is generated at runtime, and the standard equals, hashCode, toString, and clone methods are automatically generated as well. If the row interface declares a clone method which returns the exact row type, then the row can be cloned without requiring an explicit cast. If the row interface extends Comparable, then rows are comparable by primary key. Any default methods defined in the row interface are never overridden by the generated class, unless the method is defined in the Object class.

Scans over the rows of the table can be reduced by a query, described by this syntax:


 Query        = RowFilter
              | Projection [ RowFilter ]
 RowFilter    = AndFilter { "||" AndFilter }
 AndFilter    = EntityFilter { "&&" EntityFilter }
 EntityFilter = ColumnFilter | ParenFilter
 ParenFilter  = [ "!" ] "(" [ RowFilter ] ")"
 ColumnFilter = ColumnName RelOp ( ArgRef | ColumnName )
              | ColumnName "in" ArgRef
              | ArgRef RelOp ColumnName
 RelOp        = "==" | "!=" | ">=" | "<" | "<=" | ">"
 Projection   = "{" ProjColumns "}"
 ProjColumns  = [ ProjColumn { "," ProjColumn } ]
 ProjColumn   = ( ( ( ( "+" | "-" ) [ "!" ] ) | "~" ) ColumnName ) | "*"
 ColumnName   = string
 ArgRef       = "?" [ uint ]
 
Note that a query projection specifies the minimum set of requested columns, but additional ones might be provided if they were needed by the query implementation.
See Also: