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


Java Entity.addIdProperty方法代码示例

本文整理汇总了Java中de.greenrobot.daogenerator.Entity.addIdProperty方法的典型用法代码示例。如果您正苦于以下问题:Java Entity.addIdProperty方法的具体用法?Java Entity.addIdProperty怎么用?Java Entity.addIdProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在de.greenrobot.daogenerator.Entity的用法示例。


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

示例1: addNote

import de.greenrobot.daogenerator.Entity; //导入方法依赖的package包/类
/**
 * @param schema
 */
private static void addNote(Schema schema) {
    Entity note = schema.addEntity("Note");
    note.addIdProperty();
    note.addIntProperty("note_id");//笔记编号
    note.addStringProperty("guid");//用户ID
    note.addIntProperty("status");//状态
    note.addStringProperty("tag");//类型
    note.addStringProperty("label");//标题
    note.addStringProperty("content");//内容
    note.addStringProperty("imagePath");//图片目录
    note.addStringProperty("voicePath");//声音目录
    note.addLongProperty("createTime");//创建时间
    note.addLongProperty("lastOprTime");//最后修改时间

    Entity tag = schema.addEntity("Tag");//标签类型
    tag .addIdProperty();
    tag.addStringProperty("tag");
    tag.addIntProperty("size");
}
 
开发者ID:lpy19930103,项目名称:MinimalismJotter,代码行数:23,代码来源:NoteDaoGenerator.java

示例2: addCustomerOrder

import de.greenrobot.daogenerator.Entity; //导入方法依赖的package包/类
/**
 * @author:keivn
 * @param schema
 */
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);
}
 
开发者ID:DroidKOF,项目名称:pineapple,代码行数:21,代码来源:PineappleGenerator.java

示例3: addHtml

import de.greenrobot.daogenerator.Entity; //导入方法依赖的package包/类
private static void addHtml(Schema schema) {

        // 实体类
        Entity mHtmlEntity = schema.addEntity("HtmlEntity");//表名

        //列名
        mHtmlEntity.addIdProperty();//主键id
        mHtmlEntity.addStringProperty("url");//连接
        mHtmlEntity.addStringProperty("type");//类型
        mHtmlEntity.addStringProperty("title");//标题
        mHtmlEntity.addStringProperty("html");//html
        mHtmlEntity.addStringProperty("summary");//总结
        mHtmlEntity.addStringProperty("collect");//是否收藏



        mHtmlEntity.addDateProperty("hireDate");


        // 收藏实体类
        Entity mCollectEntity = schema.addEntity("CollectEntity");//表名
        mCollectEntity.addIdProperty();//主键id
        Property htmlID =   mCollectEntity.addLongProperty("html_id").getProperty();//收藏的id
        mCollectEntity.addStringProperty("collect");//是否收藏
        mCollectEntity.addToOne(mHtmlEntity, htmlID);
    }
 
开发者ID:qq137712630,项目名称:MeiZiNews,代码行数:27,代码来源:DBClass.java

示例4: addHttpCookie

import de.greenrobot.daogenerator.Entity; //导入方法依赖的package包/类
private static void addHttpCookie(Schema schema) {
    Entity entity = schema.addEntity("HttpCookieRaw");
    entity.setTableName("HTTP_COOKIE");
    entity.setClassNameDao("HttpCookieDao");
    entity.addIdProperty();
    entity.addStringProperty("name");
    entity.addStringProperty("value");
    entity.addStringProperty("comment");
    entity.addStringProperty("commentURL");
    entity.addBooleanProperty("discard");
    entity.addStringProperty("domain");
    entity.addLongProperty("maxAge");
    entity.addStringProperty("path");
    entity.addStringProperty("portList");
    entity.addBooleanProperty("secure");
    entity.addIntProperty("version");
    entity.addStringProperty("url");
    entity.addLongProperty("whenCreated");
}
 
开发者ID:seven332,项目名称:Nimingban,代码行数:20,代码来源:HttpCookieDaoGenerator.java

示例5: addAddress

import de.greenrobot.daogenerator.Entity; //导入方法依赖的package包/类
private Entity addAddress(Entity user) {
    Entity address = this.getSchema().addEntity("Address");

    address.addIdProperty();
    address.addIntProperty("number").notNull();
    address.addStringProperty("street").notNull();
    address.addStringProperty("zipCode").notNull();
    address.addStringProperty("city").notNull();
    address.addStringProperty("country").notNull();

    Property userProperty = address.addLongProperty("userId").getProperty();
    address.addToOne(user, userProperty, "user");
    user.addToMany(address, userProperty, "addresses");

    return address;
}
 
开发者ID:Gorcyn,项目名称:GreendaoSample,代码行数:17,代码来源:Version2.java

示例6: addData

import de.greenrobot.daogenerator.Entity; //导入方法依赖的package包/类
private static void addData(Schema schema){
    //一个实体类就代表一张表,此处表名为HaveRead
    Entity haveReadNews = schema.addEntity("HaveRead");

    //生成表的字段
    haveReadNews.addIdProperty();
    haveReadNews.addStringProperty("title");
    haveReadNews.addStringProperty("imageUrl");
    haveReadNews.addStringProperty("url");

    Entity collectNews = schema.addEntity("Collect");

    collectNews.addIdProperty().autoincrement();
    collectNews.addStringProperty("title");
    collectNews.addStringProperty("imageUrl");
    collectNews.addStringProperty("url");
    collectNews.addDateProperty("time");
}
 
开发者ID:Tangyingqi,项目名称:Jiemian,代码行数:19,代码来源:MyDaoGenerator.java

示例7: addCustomerOrder

import de.greenrobot.daogenerator.Entity; //导入方法依赖的package包/类
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);
}
 
开发者ID:cymcsg,项目名称:UltimateAndroid,代码行数:17,代码来源:DbDaoGenerator.java

示例8: fillEntity

import de.greenrobot.daogenerator.Entity; //导入方法依赖的package包/类
private static void fillEntity(Entity entity, Class c) throws IllegalAccessException {
    for (Field field : c.getDeclaredFields()){
        Property pt = field.getAnnotation(Property.class);
        Id id = field.getAnnotation(Id.class);
        String value = null;
        String type = null;
        de.greenrobot.daogenerator.Property.PropertyBuilder propertyBuilder = null;
        if (id != null){
            propertyBuilder = entity.addIdProperty();
            if (id.auto()){
                propertyBuilder.autoincrement();
            }
        }else if (pt != null){
            field.setAccessible(true);
            value = (String) field.get(null);
            type = pt.type();
            switch (checkPropertyType(type)){
                case 0:
                    propertyBuilder = entity.addIntProperty(value);
                    break;
                case 1:
                    propertyBuilder = entity.addStringProperty(value);
                    break;
                case 2:
                    propertyBuilder = entity.addDateProperty(value);
                    break;
            }
            if (propertyBuilder != null){
                if (pt.primaryKey()){
                    propertyBuilder.primaryKey();
                }else {
                    if (pt.notNull()){
                        propertyBuilder.notNull();
                    }
                }
            }
        }
    }
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:40,代码来源:GenerateGreenDao.java

示例9: addTokyopornVideo

import de.greenrobot.daogenerator.Entity; //导入方法依赖的package包/类
private static void addTokyopornVideo(Schema schema) {

        // 实体类
        Entity mTokyopornVideoEntity = schema.addEntity("TokyopornVideoEntity");//表名

        //列名
        mTokyopornVideoEntity.addIdProperty();//主键id
        mTokyopornVideoEntity.addStringProperty("url");//连接
        mTokyopornVideoEntity.addStringProperty("html");//html
        mTokyopornVideoEntity.addStringProperty("text");//名字
        mTokyopornVideoEntity.addStringProperty("videoUrl");//video url

        mTokyopornVideoEntity.addDateProperty("hireDate");
    }
 
开发者ID:qq137712630,项目名称:MeiZiNews,代码行数:15,代码来源:DBClass02.java

示例10: addUser

import de.greenrobot.daogenerator.Entity; //导入方法依赖的package包/类
/**
 * @author:keivn
 * @param schema
 * one -- many  user -- userAuth
 */
private static void addUser(Schema schema){
    Entity user = schema.addEntity("User");
    user.addIdProperty();
    user.addStringProperty("user_id");
    user.addStringProperty("nickname");
    user.addStringProperty("avatar");
    user.addIntProperty("gender");
    user.addStringProperty("hobbies");
    user.addStringProperty("jobs");
    user.setSuperclass("cn.bmob.v3.BmobObject");
}
 
开发者ID:DroidKOF,项目名称:pineapple,代码行数:17,代码来源:PineappleGenerator.java

示例11: addUserAuth

import de.greenrobot.daogenerator.Entity; //导入方法依赖的package包/类
/**
 * @author:keivn
 * @param schema
 */
private static void addUserAuth(Schema schema){
    Entity userAuth = schema.addEntity("UserAuth");
    userAuth.addIdProperty();
    userAuth.addStringProperty("user_id"); //对应user的objectId
    userAuth.addIntProperty("onLineType");
    userAuth.addIntProperty("identity_type");
    userAuth.addStringProperty("identify_unique_id ");//(手机号 邮箱 用户名或第三方应用的唯一标识)
    userAuth.addStringProperty("credential"); //credential 密码凭证(站内的保存密码,站外的不保存或保存token)
    userAuth.addBooleanProperty("verified"); //是否验证,三方登录默认认证了
    userAuth.addLongProperty("update_time");
    userAuth.setSuperclass("cn.bmob.v3.BmobObject");//别忘了加这句
}
 
开发者ID:DroidKOF,项目名称:pineapple,代码行数:17,代码来源:PineappleGenerator.java

示例12: addCity

import de.greenrobot.daogenerator.Entity; //导入方法依赖的package包/类
private static void addCity(Schema schema) {
    Entity Province = schema.addEntity("City");
    Province.addIdProperty();
    Province.addStringProperty("ID").notNull();
    Province.addStringProperty("PID").notNull();
    Province.addStringProperty("CityName");
}
 
开发者ID:xsingHu,项目名称:xs-android-architecture,代码行数:8,代码来源:ExampleDaoGenerator.java

示例13: addUserAction

import de.greenrobot.daogenerator.Entity; //导入方法依赖的package包/类
private static void addUserAction(Schema schema) {
    Entity note = schema.addEntity("UserAction");
    note.addIdProperty();
    note.addStringProperty("type");
    note.addStringProperty("title");
    note.addStringProperty("appointId");
    note.addStringProperty("icon");
    note.addStringProperty("icon_disabled");
    note.addDateProperty("date");
}
 
开发者ID:tengbinlive,项目名称:aibao_demo,代码行数:11,代码来源:ExampleDaoGenerator.java

示例14: createCategoryEntity

import de.greenrobot.daogenerator.Entity; //导入方法依赖的package包/类
public static Entity createCategoryEntity(Schema schema) {
    Entity category = schema.addEntity("Category");
    category.addIdProperty();
    category.addStringProperty("title").notNull();
    category.addStringProperty("description").notNull();
    category.addStringProperty("image").notNull();
    return category;
}
 
开发者ID:Kamshak,项目名称:BrainPhaser,代码行数:9,代码来源:BrainphaserDaoGenerator.java

示例15: createChallengeEntity

import de.greenrobot.daogenerator.Entity; //导入方法依赖的package包/类
public static Entity createChallengeEntity(Schema schema) {
    Entity challenge = schema.addEntity("Challenge");
    challenge.addIdProperty();
    challenge.addIntProperty("challengeType").notNull();
    challenge.addStringProperty("question").notNull();

    return challenge;
}
 
开发者ID:Kamshak,项目名称:BrainPhaser,代码行数:9,代码来源:BrainphaserDaoGenerator.java


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