當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。