@TableModelSpec(className = "BasicData", tableName = "data") public class BasicDataSpec { @PrimaryKey long dataId; String data1; String data2; String data3; int type; TestEnum someEnum; }
@TableModelSpec(className = "Tag", tableName = "tags", tableConstraint = "FOREIGN KEY(taskId) references tasks(_id) ON DELETE CASCADE") public class TagSpec { @PrimaryKey @ColumnSpec(name = "_id") long id; @ColumnSpec(constraints = "NOT NULL") String tag; @ColumnSpec(constraints = "NOT NULL") long taskId; }
@TableModelSpec(className = "TestNonIntegerPrimaryKey", tableName = "testNonIntegerPrimaryKey") public class TestNonIntegerPrimaryKeySpec { @PrimaryKey @ColumnSpec(name = "keyCol", constraints = "NOT NULL") String key; String value; }
@TableModelSpec(className = "Task", tableName = "tasks") public class TaskSpec { @PrimaryKey @ColumnSpec(name = "_id") long id; @ColumnSpec(constraints = "NOT NULL") String title; @ColumnSpec(defaultValue = "0") long completionDate; @ColumnSpec(defaultValue = "0") long dueDate; @ColumnSpec(defaultValue = "0") int priority; @ModelMethod public static boolean isCompleted(Task instance) { return instance.getCompletionDate() > 0; } }
@TableModelSpec(className = "TriggerTester", tableName = "trigger_testers") public class TriggerTesterSpec { @PrimaryKey @ColumnSpec(name = "_id") long id; @ColumnSpec(defaultValue = "0") int value1; @ColumnSpec(defaultValue = "0") int value2; String str1; String str2; }
@TableModelSpec(className = "Employee", tableName = "employees") public class EmployeeSpec { @PrimaryKey @ColumnSpec(name = "_id") long id; @ColumnSpec(constraints = "NOT NULL") String name; long managerId; @ColumnSpec(defaultValue = "true") boolean isHappy; }
@TableModelSpec(className = "Thing", tableName = "things") public class ThingSpec { public static final String DEFAULT_FOO = "thing"; public static final int DEFAULT_BAR = 100; public static final boolean DEFAULT_IS_ALIVE = true; @PrimaryKey(autoincrement = false) long id; @ColumnSpec(defaultValue = DEFAULT_FOO) String foo; @ColumnSpec(defaultValue = "100") int bar; long baz; @ColumnSpec(defaultValue = "0.0") double qux; @ColumnSpec(defaultValue = "true") boolean isAlive; byte[] blob; }