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