本文整理了Java中de.greenrobot.daogenerator.Entity.addToMany()
方法的一些代码示例,展示了Entity.addToMany()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.addToMany()
方法的具体详情如下:
包路径:de.greenrobot.daogenerator.Entity
类名称:Entity
方法名:addToMany
[英]Adds a to-many relationship; the target entity is joined to the PK property of this entity (typically the ID).
[中]为许多关系添加了一个新的元素;目标实体被加入到该实体的PK属性(通常是ID)。
代码示例来源:origin: yangblocker/GreenDao-SQLCipher
/** Adds a to-many relationship; the target entity is joined to the PK property of this entity (typically the ID). */
public ToMany addToMany(Entity target, Property targetProperty) {
Property[] targetProperties = {targetProperty};
return addToMany(null, target, targetProperties);
}
代码示例来源:origin: de.greenrobot/greendao-generator
/** Adds a to-many relationship; the target entity is joined to the PK property of this entity (typically the ID). */
public ToMany addToMany(Entity target, Property targetProperty) {
Property[] targetProperties = {targetProperty};
return addToMany(null, target, targetProperties);
}
代码示例来源:origin: de.greenrobot/greendao-generator
/**
* Add a to-many relationship; the target entity is joined using the given target property (of the target entity)
* and given source property (of this entity).
*/
public ToMany addToMany(Property sourceProperty, Entity target, Property targetProperty) {
Property[] sourceProperties = {sourceProperty};
Property[] targetProperties = {targetProperty};
return addToMany(sourceProperties, target, targetProperties);
}
代码示例来源:origin: yangblocker/GreenDao-SQLCipher
/**
* Add a to-many relationship; the target entity is joined using the given target property (of the target entity)
* and given source property (of this entity).
*/
public ToMany addToMany(Property sourceProperty, Entity target, Property targetProperty) {
Property[] sourceProperties = {sourceProperty};
Property[] targetProperties = {targetProperty};
return addToMany(sourceProperties, target, targetProperties);
}
代码示例来源:origin: yangblocker/GreenDao-SQLCipher
/**
* Convenience method for {@link Entity#addToMany(Entity, Property)} with a subsequent call to {@link
* ToMany#setName(String)}.
*/
public ToMany addToMany(Entity target, Property targetProperty, String name) {
ToMany toMany = addToMany(target, targetProperty);
toMany.setName(name);
return toMany;
}
代码示例来源:origin: de.greenrobot/greendao-generator
/**
* Convenience method for {@link Entity#addToMany(Entity, Property)} with a subsequent call to {@link
* ToMany#setName(String)}.
*/
public ToMany addToMany(Entity target, Property targetProperty, String name) {
ToMany toMany = addToMany(target, targetProperty);
toMany.setName(name);
return toMany;
}
代码示例来源:origin: Raizlabs/AndroidDatabaseLibraryComparison
public static void main(String[] args) {
Schema schema = new Schema(1, "com.raizlabs.android.databasecomparison.greendao.gen");
Entity simpleAddressItem = getAddressItemEntity(schema, "SimpleAddressItem");
Entity addressItem = getAddressItemEntity(schema, "AddressItem");
Entity contactItem = getContactItemEntity(schema);
Entity addressBook = getAddressBookEntity(schema);
addressItem.addToOne(addressBook, addressItem.getProperties().get(0));
contactItem.addToOne(addressBook, contactItem.getProperties().get(0));
addressBook.addToMany(addressItem, addressItem.getProperties().get(0));
addressBook.addToMany(contactItem, contactItem.getProperties().get(0));
try {
new DaoGenerator().generateAll(schema,
"../app/src/main/java");
} catch (Exception e) {
e.printStackTrace();
}
}
代码示例来源:origin: devinhu/androidone
@SuppressWarnings("unused")
private static void addCustomerOrder(Schema schema) {
Entity customer = schema.addEntity("Customer");
customer.addIdProperty();
customer.addStringProperty("name").notNull();
Entity order = schema.addEntity("Order");
order.setTableName("ORDERS"); // "ORDER" is a reserved keyword
order.addIdProperty();
Property orderDate = order.addDateProperty("date").getProperty();
Property customerId = order.addLongProperty("customerId").notNull().getProperty();
order.addToOne(customer, customerId);
ToMany customerToOrders = customer.addToMany(order, customerId);
customerToOrders.setName("orders");
customerToOrders.orderAsc(orderDate);
}
代码示例来源:origin: yangblocker/GreenDao-SQLCipher
private static void addCustomerOrder(Schema schema) {
Entity customer = schema.addEntity("Customer");
customer.addIdProperty();
customer.addStringProperty("name").notNull();
Entity order = schema.addEntity("Order");
order.setTableName("ORDERS"); // "ORDER" is a reserved keyword
order.addIdProperty();
Property orderDate = order.addDateProperty("date").getProperty();
Property customerId = order.addLongProperty("customerId").notNull().getProperty();
order.addToOne(customer, customerId);
ToMany customerToOrders = customer.addToMany(order, customerId);
customerToOrders.setName("orders");
customerToOrders.orderAsc(orderDate);
}
内容来源于网络,如有侵权,请联系作者删除!