当前位置: 首页>>代码示例>>Java>>正文


Java DaoGenerator类代码示例

本文整理汇总了Java中de.greenrobot.daogenerator.DaoGenerator的典型用法代码示例。如果您正苦于以下问题:Java DaoGenerator类的具体用法?Java DaoGenerator怎么用?Java DaoGenerator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DaoGenerator类属于de.greenrobot.daogenerator包,在下文中一共展示了DaoGenerator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import de.greenrobot.daogenerator.DaoGenerator; //导入依赖的package包/类
public static void main(String args[]) throws Exception{
//        System.out.print("Generating... " + args[0].toString());
        Schema schema = new Schema(54,"com.braunster.chatsdk.dao");

        schema.enableKeepSectionsByDefault();

        addUser(schema);
        addMessages(schema);
        addThread(schema);
        addLinkedAccounts(schema);
        addContactLink(schema);
        addUserThreadLink(schema);
        addFollower(schema);

        setBidirectionalRelationships();

//        setImplementation();
        setSuperClass();

        new DaoGenerator().generateAll(schema, outputDir);
    }
 
开发者ID:MobileDev418,项目名称:AndroidBackendlessChat,代码行数:22,代码来源:Generator.java

示例2: main

import de.greenrobot.daogenerator.DaoGenerator; //导入依赖的package包/类
public static void main(String[] args) throws Exception {

        // 正如你所见的,你创建了一个用于添加实体(Entity)的模式(Schema)对象。
        // 两个参数分别代表:数据库版本号与自动生成代码的包路径。
        Schema schema = new Schema(2, "thereisnospon.com.blogreader.database");
//      当然,如果你愿意,你也可以分别指定生成的 Bean 与 DAO 类所在的目录,只要如下所示:
//      Schema schema = new Schema(1, "me.itangqi.bean");
//      schema.setDefaultJavaPackageDao("me.itangqi.dao");

        // 模式(Schema)同时也拥有两个默认的 flags,分别用来标示 entity 是否是 activie 以及是否使用 keep sections。
        // schema2.enableActiveEntitiesByDefault();
        // schema2.enableKeepSectionsByDefault();

        // 一旦你拥有了一个 Schema 对象后,你便可以使用它添加实体(Entities)了。
       addHtmlCache(schema);
        addArticleType(schema);
        // 最后我们将使用 DAOGenerator 类的 generateAll() 方法自动生成代码,此处你需要根据自己的情况更改输出目录(既之前创建的 java-gen)。
        // 其实,输出目录的路径可以在 build.gradle 中设置,有兴趣的朋友可以自行搜索,这里就不再详解。
        new DaoGenerator().generateAll(schema, "./app/src/main/java/");
    }
 
开发者ID:Thereisnospon,项目名称:BlogReader,代码行数:21,代码来源:DataDaoGenerator.java

示例3: testMinimalSchema

import de.greenrobot.daogenerator.DaoGenerator; //导入依赖的package包/类
@Test
public void testMinimalSchema() throws Exception {
    Schema schema = new Schema(1, "de.greenrobot.testdao");
    Entity addressEntity = schema.addEntity("Addresse");
    Property idProperty = addressEntity.addIdProperty().getProperty();
    addressEntity.addIntProperty("count").index();
    addressEntity.addIntProperty("dummy").notNull();
    assertEquals(1, schema.getEntities().size());
    assertEquals(3, addressEntity.getProperties().size());

    File daoFile = new File("test-out/de/greenrobot/testdao/" + addressEntity.getClassName() + "Dao.java");
    daoFile.delete();
    assertFalse(daoFile.exists());

    new DaoGenerator().generateAll(schema, "test-out");

    assertEquals("PRIMARY KEY", idProperty.getConstraints());
    assertTrue(daoFile.toString(), daoFile.exists());
}
 
开发者ID:xsingHu,项目名称:xs-android-architecture,代码行数:20,代码来源:SimpleDaoGeneratorTest.java

示例4: main

import de.greenrobot.daogenerator.DaoGenerator; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    Schema schema = new Schema(13, MAIN_PACKAGE + ".entities");

    addActivityDescription(schema);

    Entity userAttributes = addUserAttributes(schema);
    Entity user = addUserInfo(schema, userAttributes);

    Entity deviceAttributes = addDeviceAttributes(schema);
    Entity device = addDevice(schema, deviceAttributes);

    addMiBandActivitySample(schema, user, device);
    addPebbleHealthActivitySample(schema, user, device);
    addPebbleHealthActivityKindOverlay(schema, user, device);
    addPebbleMisfitActivitySample(schema, user, device);
    addPebbleMorpheuzActivitySample(schema, user, device);

    new DaoGenerator().generateAll(schema, "app/src/main/java");
}
 
开发者ID:scifiswapnil,项目名称:gadgetbridge_artikcloud,代码行数:20,代码来源:GBDaoGenerator.java

示例5: main

import de.greenrobot.daogenerator.DaoGenerator; //导入依赖的package包/类
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();
    }
}
 
开发者ID:Raizlabs,项目名称:AndroidDatabaseLibraryComparison,代码行数:24,代码来源:Generator.java

示例6: generate

import de.greenrobot.daogenerator.DaoGenerator; //导入依赖的package包/类
public static void generate() throws Exception {
    Utilities.deleteContents(new File(DELETE_DIR));
    File outDir = new File(OUT_DIR);
    outDir.delete();
    outDir.mkdirs();

    Schema schema = new Schema(VERSION, PACKAGE);
    addDownloads(schema);
    addDownloadLabel(schema);
    addDownloadDirname(schema);
    addHistoryInfo(schema);
    addQuickSearch(schema);
    addLocalFavorites(schema);
    addBookmarks(schema);
    addFilter(schema);
    new DaoGenerator().generateAll(schema, OUT_DIR);

    adjustDownloadInfo();
    adjustHistoryInfo();
    adjustQuickSearch();
    adjustLocalFavoriteInfo();
    adjustBookmarkInfo();
    adjustFilter();
}
 
开发者ID:seven332,项目名称:EhViewer,代码行数:25,代码来源:EhDaoGenerator.java

示例7: main

import de.greenrobot.daogenerator.DaoGenerator; //导入依赖的package包/类
public static void main(String args[]) throws Exception {
    Schema schema = new Schema(3, "greendao");

    Entity verses = schema.addEntity("Verse");
    verses.setTableName("verses");
    verses.addIdProperty().columnName("_rowid_");
    verses.addIntProperty("chapter");
    verses.addIntProperty("verse");
    verses.addStringProperty("book");
    verses.addStringProperty("header");
    verses.addStringProperty("subheader");
    verses.addStringProperty("text");

    Entity books = schema.addEntity("Book");
    books.addLongProperty("indice").primaryKey().unique();
    books.setTableName("books");
    books.addStringProperty("name");
    books.addStringProperty("abbreviation");
    books.addStringProperty("testament");

    new DaoGenerator().generateAll(schema, args[0]);
}
 
开发者ID:diegoponciano,项目名称:biblia-ccb,代码行数:23,代码来源:BibliaDaoGenerator.java

示例8: main

import de.greenrobot.daogenerator.DaoGenerator; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    Schema schema = new Schema(3, "br.com.ricardolonga.mercadinho");

    Entity categoria = schema.addEntity("Categoria");
    categoria.addIdProperty().autoincrement();
    categoria.addStringProperty("nome").notNull();
    categoria.implementsSerializable();

    Entity item = schema.addEntity("Item");
    item.addIdProperty().autoincrement();
    item.addStringProperty("nome").notNull();
    item.addIntProperty("quantidade");
    item.addDoubleProperty("valorUnitario");
    item.addDoubleProperty("valorTotal");
    item.implementsSerializable();
    Property idCategoria = item.addLongProperty("idCategoria").notNull().getProperty();

    item.addToOne(categoria, idCategoria);
    categoria.addToMany(item, idCategoria, "itens");

    new DaoGenerator().generateAll(schema, "../mercadinho/src-gen");
}
 
开发者ID:ricardolonga,项目名称:mercadinho-generator,代码行数:23,代码来源:MercadinhoGenerator.java

示例9: testMinimalSchema

import de.greenrobot.daogenerator.DaoGenerator; //导入依赖的package包/类
@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());
}
 
开发者ID:itsmechlark,项目名称:greendao-cipher,代码行数:20,代码来源:SimpleDaoGeneratorTest.java

示例10: main

import de.greenrobot.daogenerator.DaoGenerator; //导入依赖的package包/类
public static void main(String[] args) {
    Schema schema = new Schema(DB_VERSION, PACKAGE);

    Entity user = schema.addEntity(USER_ENTITY);
    Property userPk = addCommonColumns(user);

    Entity message = schema.addEntity(MESSAGE_ENTITY);
    message.addIdProperty().autoincrement();
    message.addStringProperty(CONTENT);
    message.addLongProperty(CLIENT_ID);
    message.addIntProperty(CREATED_AT);
    message.addDoubleProperty(SORTED_BY);
    message.addLongProperty(COMMAND_ID).index();
    message.addLongProperty(SENDER_ID).notNull();
    message.addLongProperty(CHANNEL_ID).notNull();

    // One-to-many relationship
    message.addToMany(user, userPk, READERS);

    try {
        new DaoGenerator().generateAll(schema, "../ORM-Benchmark/src/");
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:littleinc,项目名称:android-orm-benchmark,代码行数:26,代码来源:Generator.java

示例11: main

import de.greenrobot.daogenerator.DaoGenerator; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    Schema schema = new Schema(DB_VERSION, "com.gmobile.sqliteeditor.orm.dao.model");
    schema.setDefaultJavaPackageDao("com.gmobile.sqliteeditor.orm.dao.base");

    addAppData(schema);
    addHistoryRecord(schema);
    addMineRecord(schema);

    new DaoGenerator().generateAll(schema, getCurrentProjectPath() + "/app/src/main/java/");
}
 
开发者ID:WeiMei-Tian,项目名称:editor-sql,代码行数:11,代码来源:ExampleDaoGenerator.java

示例12: main

import de.greenrobot.daogenerator.DaoGenerator; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
        Schema schema = new Schema(1, "com.lipy.mylibrary.dao.core");
        schema.enableKeepSectionsByDefault();

        addPedometer(schema);
//        new DaoGenerator().generateAll(schema, "E:/project/AndroidPedometer/mylibrary/src/main/java/");
        new DaoGenerator().generateAll(schema, "/Users/lipy/Documents/AndroidPedometer/mylibrary/src/main/java/");

    }
 
开发者ID:lpy19930103,项目名称:AndroidPedometer,代码行数:10,代码来源:generatePedometerDataBase.java

示例13: main

import de.greenrobot.daogenerator.DaoGenerator; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    int dbVersion = 12;
    Schema schema = new Schema(dbVersion, "com.mogujie.tt.DB.dao");

    schema.enableKeepSectionsByDefault();
    addDepartment(schema);
    addUserInfo(schema);
    addGroupInfo(schema);
    addMessage(schema);
    addSessionInfo(schema);

    // todo 绝对路径,根据自己的路径设定, 例子如下
    String path = "/Users/yingmu/software/IM/TT/ttandroidclientnew/app/src/main/java";
    new DaoGenerator().generateAll(schema, path);
}
 
开发者ID:ccfish86,项目名称:sctalk,代码行数:16,代码来源:GreenDaoGenerator.java

示例14: main

import de.greenrobot.daogenerator.DaoGenerator; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    Schema schema = new Schema(1000, "pineapple.bd.com.pineapple.db");

    //注释内容为范例,生成的时候别打开!
    // addNote(schema);
    //addCustomerOrder(schema);

    addUser(schema);
    addUserAuth(schema);
    addMusic(schema);

    //用绝对路径找!
    new DaoGenerator().generateAll(schema, "app/src/main/java");
}
 
开发者ID:DroidKOF,项目名称:pineapple,代码行数:15,代码来源:PineappleGenerator.java

示例15: main

import de.greenrobot.daogenerator.DaoGenerator; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    Schema schema = new Schema(1, "com.fangxu.dota2helper.greendao");
    addNews(schema);
    addStrategy(schema);
    addUpdate(schema);
    addVideo(schema);
    addHistoryVideo(schema);
    new DaoGenerator().generateAll(schema, "../Dota2Helper/app/src/main/java-gen");
}
 
开发者ID:uin3566,项目名称:Dota2Helper,代码行数:10,代码来源:GreenDaoGenerator.java


注:本文中的de.greenrobot.daogenerator.DaoGenerator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。