de.greenrobot.daogenerator.Entity.getProperties()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(140)

本文整理了Java中de.greenrobot.daogenerator.Entity.getProperties()方法的一些代码示例,展示了Entity.getProperties()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.getProperties()方法的具体详情如下:
包路径:de.greenrobot.daogenerator.Entity
类名称:Entity
方法名:getProperties

Entity.getProperties介绍

[英]Internal property used by templates, don't use during entity definition.
[中]模板使用的内部属性,在实体定义期间不使用。

代码示例

代码示例来源: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

@Test
public void testMinimalSchema() throws Exception {
  Schema schema = new Schema(1, "de.greenrobot.testdao");
  Entity adressTable = schema.addEntity("Adresse");
  Property idProperty = adressTable.addIdProperty().getProperty();
  adressTable.addIntProperty("count").index();
  adressTable.addIntProperty("dummy").notNull();
  assertEquals(1, schema.getEntities().size());
  assertEquals(3, adressTable.getProperties().size());
  File daoFile = new File("test-out/de/greenrobot/testdao/" + adressTable.getClassName() + "Dao.java");
  daoFile.delete();
  assertFalse(daoFile.exists());
  new DaoGenerator().generateAll(schema, "test-out");
  assertEquals("PRIMARY KEY", idProperty.getConstraints());
  assertTrue(daoFile.toString(), daoFile.exists());
}

相关文章