• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DaoGenerator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: main

import org.greenrobot.greendao.generator.DaoGenerator; //导入依赖的package包/类
public static void main(String...args){
    Schema rootSchema = new Schema(5, "com.thirtydegreesray.openhub.dao");
    addAuthUser(rootSchema);
    addTraceUser(rootSchema);
    addTraceRepo(rootSchema);
    addBookMarkUser(rootSchema);
    addBookMarkRepo(rootSchema);
    addLocalUser(rootSchema);
    addLocalRepo(rootSchema);
    addTrace(rootSchema);
    addBookmark(rootSchema);
    addMyTrendingLanguage(rootSchema);
    try {
        new DaoGenerator().generateAll(rootSchema, "E:/Work/Android/github/OpenHub/OpenHub/app/src/main/java");
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:ThirtyDegreesRay,项目名称:OpenHub,代码行数:19,代码来源:AppDaoGenerator.java


示例2: generateSchemas

import org.greenrobot.greendao.generator.DaoGenerator; //导入依赖的package包/类
private static void generateSchemas() throws Exception, IOException {

    Schema schema =
        new Schema(Config.BATTERY_WATCHER_DB_SCHEMA_VERSION, Config.BATTERY_WATCHER_PACKAGE);

    // ----- Measurements -----
    Entity measurements = schema.addEntity("Measurement");
    measurements.setTableName("measurement");
    measurements.addIdProperty().autoincrement().index();
    measurements.addFloatProperty("power");
    measurements.addLongProperty("memory");
    measurements.addFloatProperty("cpuLoad");
    measurements.addLongProperty("timestamp").notNull();

    // **************************
    // **** GENERATE DAOs ****
    // **************************
    new DaoGenerator().generateAll(schema, Config.BATTERY_WATCHER_OUTPUT);
  }
 
开发者ID:Telecooperation,项目名称:assistance-platform-client-sdk-android,代码行数:20,代码来源:BatteryWatcherDatabaseGenerator.java


示例3: main

import org.greenrobot.greendao.generator.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).notNull();
    message.addIntProperty(CREATED_AT).notNull();
    message.addDoubleProperty(SORTED_BY).notNull();
    message.addLongProperty(COMMAND_ID).notNull().index();
    message.addLongProperty(SENDER_ID).notNull();
    message.addLongProperty(CHANNEL_ID).notNull();

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

    try {
        System.out.println("current path: " + new File(".").getAbsolutePath());
        new DaoGenerator().generateAll(schema, "./ORM-Benchmark/src/main/java/");
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:touchlab,项目名称:android-orm-benchmark-updated,代码行数:27,代码来源:Generator.java


示例4: main

import org.greenrobot.greendao.generator.DaoGenerator; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
    Schema schema = new Schema(3, "pl.srw.billcalculator.db");
    schema.setDefaultJavaPackageDao("pl.srw.billcalculator.db.dao");

    Entity pgePrices = addPgePrices(schema);
    addPgeG11Bill(schema, pgePrices);
    addPgeG12Bill(schema, pgePrices);

    Entity pgnigPrices = addPgnigPrices(schema);
    addPgnigBill(schema, pgnigPrices);

    Entity tauronPrices = addTauronPrices(schema);
    addTauronG11Bill(schema, tauronPrices);
    addTauronG12Bill(schema, tauronPrices);

    addHistory(schema);

    File output = new File(args.length == 1 ? args[0] : OUTPUT_DIR);
    new DaoGenerator().generateAll(schema, output.getAbsolutePath());
}
 
开发者ID:sewerk,项目名称:Bill-Calculator,代码行数:21,代码来源:GreenDaoGenerator.java


示例5: main

import org.greenrobot.greendao.generator.DaoGenerator; //导入依赖的package包/类
public static void main(String args[]) throws Exception {
    //创建了一个用于添加实体(Entity)的模式(Schema)对象。
    Schema schema = new Schema(1, "com.example.jp");
    schema.enableKeepSectionsByDefault();//加入自己的一些信息,下次生成的时候不消失
    //一个实体(类)就关联到数据库中的一张表,此处表名为User(类名)
    Entity userBean = schema.addEntity("User");

    //添加字段
    userBean.addIdProperty();
    userBean.addStringProperty("number");
    userBean.addStringProperty("password");

    //生成DAO
    new DaoGenerator().generateAll(schema, "app/src/main/java-gen");
}
 
开发者ID:jp1017,项目名称:greenDAO-demo,代码行数:16,代码来源:DaoGen.java


示例6: generate

import org.greenrobot.greendao.generator.DaoGenerator; //导入依赖的package包/类
public void generate() throws Exception {
    DaoGenerator daoGenerator = new DaoGenerator();
    daoGenerator.generateAll(schema, "../DaoTestBase/src/main/java");
    daoGenerator.generateAll(schema2, "../DaoTestBase/src/main/java");
    daoGenerator.generateAll(schemaUnitTest, "../DaoTest/src/test/java");
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:TestDaoGenerator.java


示例7: main

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


        Schema schema = new Schema(8, "com.lidchanin.crudindiploma.database");
        schema.setDefaultJavaPackageDao("com.lidchanin.crudindiploma.database.dao");
        schema.enableKeepSectionsByDefault();

        Entity shoppingList = schema.addEntity("ShoppingList");
        shoppingList.addIdProperty()
                .codeBeforeField("/* id */");
        shoppingList.addStringProperty("name").notNull()
                .codeBeforeField("/* shopping list name */");
        shoppingList.addLongProperty("date").notNull()
                .codeBeforeField("/* date of creation */");

        Entity product = schema.addEntity("Product");
        product.addIdProperty()
                .codeBeforeField("/* id */");
        product.addStringProperty("name").notNull().unique()
                .codeBeforeField("/* product name */");
        product.addDoubleProperty("cost").notNull()
                .codeBeforeField("/* product cost */");

        Entity usedProduct = schema.addEntity("UsedProduct");
        usedProduct.addIdProperty()
                .codeBeforeField("/* id */");
        usedProduct.addDoubleProperty("quantity").notNull()
                .codeBeforeField("/* used product quantity */");
        usedProduct.addBooleanProperty("unit").notNull()
                .codeBeforeField("/* true -> kg, false -> pieces */");
        usedProduct.addBooleanProperty("isPurchased").notNull()
                .codeBeforeField("/* true -> purchased, false -> not */");
        usedProduct.addLongProperty("date").notNull().unique()
                .codeBeforeField("/* date when the product in the shopping list was marked as" +
                        " purchased */");

        Entity statistic = schema.addEntity("Statistic");
        statistic.addIdProperty()
                .codeBeforeField("/* id */");
        statistic.addStringProperty("name").notNull()
                .codeBeforeField("/* product name */");
        statistic.addDoubleProperty("quantity").notNull()
                .codeBeforeField("/* used product quantity */");
        statistic.addDoubleProperty("totalCost").notNull()
                .codeBeforeField("/* product cost * used product quantity * product cost */");
        statistic.addBooleanProperty("unit").notNull()
                .codeBeforeField("/* true -> kg, false -> pieces */");
        statistic.addLongProperty("date").notNull()
                .codeBeforeField("/* date when the product in the shopping list was marked as" +
                        " purchased */");

        //Creating One-To-One relation, used product has "one" product
        Property productId = usedProduct.addLongProperty("productId").getProperty();
        usedProduct.addToOne(product, productId);

        //Creating One-To-Many relation, shopping list has "many" used products
        Property shoppingListIdProperty = usedProduct.addLongProperty("shoppingListId")
                .notNull().getProperty();
        ToMany shoppingListToExistingProducts = shoppingList.addToMany(usedProduct,
                shoppingListIdProperty);
        shoppingListToExistingProducts.setName("usedProducts");

        new DaoGenerator().generateAll(schema, "../app/src/main/java");
    }
 
开发者ID:Lidchanin,项目名称:Shopping_List,代码行数:65,代码来源:GreenDaoGenerator.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FilterAtomicReader类代码示例发布时间:2022-05-23
下一篇:
Java PercolateResponse类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap