當前位置: 首頁>>代碼示例>>Java>>正文


Java Entity.addDateProperty方法代碼示例

本文整理匯總了Java中de.greenrobot.daogenerator.Entity.addDateProperty方法的典型用法代碼示例。如果您正苦於以下問題:Java Entity.addDateProperty方法的具體用法?Java Entity.addDateProperty怎麽用?Java Entity.addDateProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在de.greenrobot.daogenerator.Entity的用法示例。


在下文中一共展示了Entity.addDateProperty方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addNote

import de.greenrobot.daogenerator.Entity; //導入方法依賴的package包/類
/**
 * @param schema
 */
private static void addNote(Schema schema) {
    // 一個實體(類)就關聯到數據庫中的一張表,此處表名為「Note」(既類名)
    Entity note = schema.addEntity("Note");
    // 你也可以重新給表命名
    // note.setTableName("NODE");

    // greenDAO 會自動根據實體類的屬性值來創建表字段,並賦予默認值
    // 接下來你便可以設置表中的字段:
    note.addIdProperty();
    note.addStringProperty("text").notNull();
    // 與在 Java 中使用駝峰命名法不同,默認數據庫中的命名是使用大寫和下劃線來分割單詞的。
    // For example, a property called “creationDate” will become a database column “CREATION_DATE”.
    note.addStringProperty("comment");
    note.addDateProperty("date");
}
 
開發者ID:Thereisnospon,項目名稱:BlogReader,代碼行數:19,代碼來源:DataDaoGenerator.java

示例2: 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

示例3: 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

示例4: addSources

import de.greenrobot.daogenerator.Entity; //導入方法依賴的package包/類
private static void addSources(Schema schema) {
    Entity source = schema.addEntity("Source");
    source.addIdProperty().index();
    source.addStringProperty("name").notNull();
    source.addStringProperty("iconUrl");
    source.addDateProperty("postDate");
    source.addStringProperty("introduction");
    source.addStringProperty("creator");
    source.addStringProperty("creatorUrl");
    source.addStringProperty("server");
    source.addStringProperty("serverUrl");
    source.addStringProperty("dataFormat");
    source.addStringProperty("installUrl").notNull();
    source.addStringProperty("codeUrl").index().notNull();
    source.addStringProperty("storeUrl");
    source.addBooleanProperty("installed").index();
}
 
開發者ID:cloud-emoticon,項目名稱:SmallCloudEmoji,代碼行數:18,代碼來源:AppDaoGenerator.java

示例5: 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

示例6: addNote

import de.greenrobot.daogenerator.Entity; //導入方法依賴的package包/類
/**
 * @author:keivn
 * @param schema
 */
private static void addNote(Schema schema) {
    Entity note = schema.addEntity("Note");
    note.addIdProperty();
    note.addStringProperty("text").notNull();
    note.addStringProperty("comment");
    note.addDateProperty("date");
}
 
開發者ID:DroidKOF,項目名稱:pineapple,代碼行數:12,代碼來源:PineappleGenerator.java

示例7: createCompletedEntity

import de.greenrobot.daogenerator.Entity; //導入方法依賴的package包/類
public static Entity createCompletedEntity(Schema schema) {
    Entity completed = schema.addEntity("Completion");
    completed.addIdProperty();
    completed.addIntProperty("stage");
    completed.addDateProperty("lastCompleted");

    return completed;
}
 
開發者ID:Kamshak,項目名稱:BrainPhaser,代碼行數:9,代碼來源:BrainphaserDaoGenerator.java

示例8: createStatisticsEntity

import de.greenrobot.daogenerator.Entity; //導入方法依賴的package包/類
public static Entity createStatisticsEntity(Schema schema) {
    Entity completed = schema.addEntity("Statistics");
    completed.addIdProperty();
    completed.addBooleanProperty("succeeded");
    completed.addDateProperty("time");

    return completed;
}
 
開發者ID:Kamshak,項目名稱:BrainPhaser,代碼行數:9,代碼來源:BrainphaserDaoGenerator.java

示例9: createSettingsEntity

import de.greenrobot.daogenerator.Entity; //導入方法依賴的package包/類
public static Entity createSettingsEntity(Schema schema) {
    Entity settings = schema.addEntity("Settings");

    settings.addIdProperty();
    settings.addDateProperty("timeBoxStage1");
    settings.addDateProperty("timeBoxStage2");
    settings.addDateProperty("timeBoxStage3");
    settings.addDateProperty("timeBoxStage4");
    settings.addDateProperty("timeBoxStage5");
    settings.addDateProperty("timeBoxStage6");

    return settings;
}
 
開發者ID:Kamshak,項目名稱:BrainPhaser,代碼行數:14,代碼來源:BrainphaserDaoGenerator.java

示例10: createV2Schema

import de.greenrobot.daogenerator.Entity; //導入方法依賴的package包/類
private static void createV2Schema(Schema v2) {

        //Define entities
        final Entity companyEntity = v2.addEntity("Company");
        companyEntity.addIdProperty().autoincrement();
        companyEntity.addStringProperty("companyCode").notNull().unique().index();
        companyEntity.addStringProperty("name").notNull();
        companyEntity.addStringProperty("address");
        companyEntity.addDateProperty("incorporationDate");

        final Entity functionEntity = v2.addEntity("Function");
        functionEntity.addIdProperty().autoincrement();
        functionEntity.addStringProperty("functionCode").notNull().unique();
        functionEntity.addStringProperty("name").notNull();

        final Entity employeeEntity = v2.addEntity("Employee");
        employeeEntity.addIdProperty().autoincrement();
        employeeEntity.addStringProperty("employeeId").notNull().unique();
        employeeEntity.addStringProperty("designation").notNull().index();
        employeeEntity.addStringProperty("name").notNull();
        employeeEntity.addIntProperty("age");
        employeeEntity.addStringProperty("sex").index();
        employeeEntity.addDateProperty("dateOfBirth");
        employeeEntity.addDateProperty("dateOfJoining").notNull();

        final Entity orderEntity = v2.addEntity("Order");
        orderEntity.addIdProperty().autoincrement();
        orderEntity.addStringProperty("orderId").notNull().unique().index();
        orderEntity.addDateProperty("orderDate").notNull();

        //Define relationships
        final Property functionCompanyId = functionEntity.addLongProperty("companyId").notNull().getProperty();
        functionEntity.addToOne(companyEntity, functionCompanyId);
        companyEntity.addToMany(functionEntity, functionCompanyId);

        final Property employeeFunctionId = employeeEntity.addLongProperty("functionId").notNull().getProperty();
        employeeEntity.addToOne(functionEntity, employeeFunctionId);
        functionEntity.addToMany(employeeEntity, employeeFunctionId);
    }
 
開發者ID:vinaysshenoy,項目名稱:poirot,代碼行數:40,代碼來源:Generator.java

示例11: createV1Schema

import de.greenrobot.daogenerator.Entity; //導入方法依賴的package包/類
private static void createV1Schema(Schema v1) {

        //Define entities
        final Entity companyEntity = v1.addEntity("Company");
        companyEntity.addIdProperty().autoincrement();
        companyEntity.addStringProperty("companyCode").notNull().unique().index();
        companyEntity.addStringProperty("name").notNull();
        companyEntity.addStringProperty("address");

        final Entity functionEntity = v1.addEntity("Function");
        functionEntity.addIdProperty().autoincrement();
        functionEntity.addStringProperty("functionCode").notNull().unique();
        functionEntity.addStringProperty("name").notNull();

        final Entity employeeEntity = v1.addEntity("Employee");
        employeeEntity.addIdProperty().autoincrement();
        employeeEntity.addStringProperty("employeeId").notNull().unique();
        employeeEntity.addStringProperty("designation").notNull().index();
        employeeEntity.addStringProperty("name").notNull();
        employeeEntity.addIntProperty("age");
        employeeEntity.addStringProperty("sex").index();
        employeeEntity.addDateProperty("dateOfBirth");

        //Define relationships
        final Property functionCompanyId = functionEntity.addLongProperty("companyId").notNull().getProperty();
        functionEntity.addToOne(companyEntity, functionCompanyId);
        companyEntity.addToMany(functionEntity, functionCompanyId);

        final Property employeeFunctionId = employeeEntity.addLongProperty("functionId").notNull().getProperty();
        employeeEntity.addToOne(functionEntity, employeeFunctionId);
        functionEntity.addToMany(employeeEntity, employeeFunctionId);
    }
 
開發者ID:vinaysshenoy,項目名稱:poirot,代碼行數:33,代碼來源:Generator.java

示例12: addCollect

import de.greenrobot.daogenerator.Entity; //導入方法依賴的package包/類
private static void addCollect(Schema schema) {

        // 實體類
        Entity mCollectEntity = schema.addEntity("CollectEntity");//表名

        //列名
        mCollectEntity.addIdProperty();//主鍵id
        mCollectEntity.addStringProperty("url");//連接
        mCollectEntity.addStringProperty("type");//連接類型
        mCollectEntity.addStringProperty("text");//名字

        mCollectEntity.addDateProperty("hireDate");
    }
 
開發者ID:qq137712630,項目名稱:MeiZiNews,代碼行數:14,代碼來源:DBClass02.java

示例13: 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

示例14: 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

示例15: addLike

import de.greenrobot.daogenerator.Entity; //導入方法依賴的package包/類
private static void addLike(Schema schema) {
    Entity like = schema.addEntity("Like");
    like.addIdProperty();
    like.addStringProperty("newid").unique();
    like.addStringProperty("avatar");
    like.addStringProperty("title");
    like.addStringProperty("cover");
    like.addStringProperty("detailNew");
    like.addStringProperty("category");
    like.addDateProperty("createTime");
}
 
開發者ID:x251089003,項目名稱:EveryXDay,代碼行數:12,代碼來源:EveryXDayDBGenerator.java


注:本文中的de.greenrobot.daogenerator.Entity.addDateProperty方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。