Beispiel #1
0
 public PropertyBuilder addProperty(PropertyType propertyType, String propertyName) {
   if (!propertyNames.add(propertyName)) {
     throw new RuntimeException("Property already defined: " + propertyName);
   }
   PropertyBuilder builder =
       new Property.PropertyBuilder(schema, this, propertyType, propertyName);
   properties.add(builder.getProperty());
   return builder;
 }
Beispiel #2
0
 public ToOne addToOneWithoutProperty(
     String name, Entity target, String fkColumnName, boolean notNull, boolean unique) {
   PropertyBuilder propertyBuilder = new PropertyBuilder(schema, this, null, name);
   if (notNull) {
     propertyBuilder.notNull();
   }
   if (unique) {
     propertyBuilder.unique();
   }
   propertyBuilder.columnName(fkColumnName);
   Property column = propertyBuilder.getProperty();
   Property[] fkColumns = {column};
   ToOne toOne = new ToOne(schema, this, target, fkColumns, false);
   toOne.setName(name);
   toOneRelations.add(toOne);
   return toOne;
 }
Beispiel #3
0
 /** Adds a standard _id column required by standard Android classes, e.g. list adapters. */
 public PropertyBuilder addIdProperty() {
   PropertyBuilder builder = addLongProperty("id");
   builder.columnName("_id").primaryKey();
   return builder;
 }