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


Java Schema.addEntity方法代碼示例

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


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

示例1: addGroupInfo

import de.greenrobot.daogenerator.Schema; //導入方法依賴的package包/類
private static void addGroupInfo(Schema schema) {
    Entity groupInfo = schema.addEntity("GroupEntity");
    groupInfo.setTableName("GroupInfo");
    groupInfo.setClassNameDao("GroupDao");
    groupInfo.setJavaPackage(entityPath);

    groupInfo.addIdProperty().autoincrement();
    groupInfo.addIntProperty("peerId").unique().notNull();
    groupInfo.addIntProperty("groupType").notNull();
    groupInfo.addStringProperty("mainName").notNull();
    groupInfo.addStringProperty("avatar").notNull();
    groupInfo.addIntProperty("creatorId").notNull();
    groupInfo.addIntProperty("userCnt").notNull();

    groupInfo.addStringProperty("userList").notNull();
    groupInfo.addIntProperty("version").notNull();
    groupInfo.addIntProperty("status").notNull();
    groupInfo.addIntProperty("created").notNull();
    groupInfo.addIntProperty("updated").notNull();

    groupInfo.setHasKeepSections(true);
}
 
開發者ID:ccfish86,項目名稱:sctalk,代碼行數:23,代碼來源:GreenDaoGenerator.java

示例2: addThread

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

    thread = schema.addEntity(EntityProperties.BThread);
    thread.addIdProperty();
    threadId = thread.addStringProperty(EntityProperties.EntityID).getProperty();
    thread.addDateProperty(EntityProperties.CreationDate);
    thread.addBooleanProperty(EntityProperties.HasUnreadMessaged);
    thread.addBooleanProperty(EntityProperties.BDeleted);
    thread.addStringProperty(EntityProperties.Name);
    thread.addDateProperty(EntityProperties.LastMessageAdded);
    thread.addIntProperty(EntityProperties.Type);
    thread.addStringProperty(EntityProperties.CreatorEntityID);
    thread.addStringProperty(EntityProperties.BThreadImageUrl);
    thread.addStringProperty(EntityProperties.RootKey).columnName(EntityProperties.C_RootKey);
    thread.addStringProperty(EntityProperties.ApiKey).columnName(EntityProperties.C_ApiKey);

    Property threadPropCreator = thread.addLongProperty(EntityProperties.CreatorID).getProperty();
    ToOne threadToOneCreator = thread.addToOne(user, threadPropCreator);
    threadToOneCreator.setName(EntityProperties.Creator);

    return threadId;
}
 
開發者ID:MobileDev418,項目名稱:AndroidBackendlessChat,代碼行數:24,代碼來源:Generator.java

示例3: addMessages

import de.greenrobot.daogenerator.Schema; //導入方法依賴的package包/類
private static Property addMessages(Schema schema){
    Property messageId;
    message = schema.addEntity(EntityProperties.BMessage);
    message.addIdProperty();
    messageId = message.addStringProperty(EntityProperties.EntityID).getProperty();
    message.addDateProperty(EntityProperties.Date);
    message.addBooleanProperty(EntityProperties.isRead);
    message.addStringProperty(EntityProperties.Resource);
    message.addStringProperty(EntityProperties.ResourcePath);
    message.addStringProperty(EntityProperties.Text);
    message.addStringProperty(EntityProperties.ImageDimensions);
    message.addIntProperty(EntityProperties.Type);
    message.addIntProperty(EntityProperties.Status);
    message.addIntProperty(EntityProperties.Delivered);

    // The sender ID
    Property messagePropSender = message.addLongProperty("Sender").getProperty();
    ToOne messageToOneSender = message.addToOne(user, messagePropSender);
    messageToOneSender.setName("BUserSender");

    return messageId;
}
 
開發者ID:MobileDev418,項目名稱:AndroidBackendlessChat,代碼行數:23,代碼來源:Generator.java

示例4: addDepartment

import de.greenrobot.daogenerator.Schema; //導入方法依賴的package包/類
private static void addDepartment(Schema schema){
    Entity department = schema.addEntity("DepartmentEntity");
    department.setTableName("Department");
    department.setClassNameDao("DepartmentDao");
    department.setJavaPackage(entityPath);

    department.addIdProperty().autoincrement();
    department.addIntProperty("departId").unique().notNull().index();
    department.addStringProperty("departName").unique().notNull().index();
    department.addIntProperty("priority").notNull();
    department.addIntProperty("status").notNull();

    department.addIntProperty("created").notNull();
    department.addIntProperty("updated").notNull();

    department.setHasKeepSections(true);
}
 
開發者ID:ccfish86,項目名稱:sctalk,代碼行數:18,代碼來源:GreenDaoGenerator.java

示例5: addMessage

import de.greenrobot.daogenerator.Schema; //導入方法依賴的package包/類
private static Entity addMessage(Schema schema){
    Entity message = schema.addEntity("Message");
    message.addIdProperty().primaryKey().autoincrement();
    message.addStringProperty("message_id");
    message.addStringProperty("created_at");
    message.addStringProperty("updated_at");
    message.addStringProperty("attachments");
    message.addStringProperty("read_ids");
    message.addStringProperty("delivered_ids");
    message.addStringProperty("chat_dialog_id");
    message.addLongProperty("date_sent");
    message.addStringProperty("message");
    message.addStringProperty("recipient_id");
    message.addIntProperty("sender_id");
    message.addIntProperty("read");
    return message;
}
 
開發者ID:ukevgen,項目名稱:BizareChat,代碼行數:18,代碼來源:InitDao.java

示例6: addSessionInfo

import de.greenrobot.daogenerator.Schema; //導入方法依賴的package包/類
private static void addSessionInfo(Schema schema){
    Entity sessionInfo = schema.addEntity("SessionEntity");
    sessionInfo.setTableName("Session");
    sessionInfo.setClassNameDao("SessionDao");
    sessionInfo.setJavaPackage(entityPath);

    //point to userId/groupId need sessionType 區分
    sessionInfo.addIdProperty().autoincrement();
    sessionInfo.addStringProperty("sessionKey").unique().notNull(); //.unique()
    sessionInfo.addIntProperty("peerId").notNull();
    sessionInfo.addIntProperty("peerType").notNull();

    sessionInfo.addIntProperty("latestMsgType").notNull();
    sessionInfo.addIntProperty("latestMsgId").notNull();
    sessionInfo.addStringProperty("latestMsgData").notNull();

    sessionInfo.addIntProperty("talkId").notNull();
    sessionInfo.addIntProperty("created").notNull();
    sessionInfo.addIntProperty("updated").notNull();

    sessionInfo.setHasKeepSections(true);
}
 
開發者ID:ccfish86,項目名稱:sctalk,代碼行數:23,代碼來源:GreenDaoGenerator.java

示例7: testMinimalSchema

import de.greenrobot.daogenerator.Schema; //導入方法依賴的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

示例8: addNote

import de.greenrobot.daogenerator.Schema; //導入方法依賴的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

示例9: addHtml

import de.greenrobot.daogenerator.Schema; //導入方法依賴的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

示例10: getTable

import de.greenrobot.daogenerator.Schema; //導入方法依賴的package包/類
public static Entity getTable(Schema schema, Class c){
    Entity entity = null;
    String table = null;
    try {
        Field field = c.getDeclaredField("TABLE_NAME");
        field.setAccessible(true);
        table = (String) field.get(null);
        table = table.substring(0,1).toUpperCase() + table.substring(1);
        entity = schema.addEntity(table);
    } catch (Exception e) {
    }

    return entity;
}
 
開發者ID:zuoweitan,項目名稱:Hitalk,代碼行數:15,代碼來源:AnalysisDao.java

示例11: addContactLink

import de.greenrobot.daogenerator.Schema; //導入方法依賴的package包/類
private static Property addContactLink(Schema schema) {
    Property contactLinkId;
    Entity contactLink = schema.addEntity(EntityProperties.ContactLink);
    contactLinkId = contactLink.addIdProperty().getProperty();
    setManyToMany(contactLink, user, user);

    contactLink.setSuperclass("Entity");

    return contactLinkId;
}
 
開發者ID:MobileDev418,項目名稱:AndroidBackendlessChat,代碼行數:11,代碼來源:Generator.java

示例12: addUserThreadLink

import de.greenrobot.daogenerator.Schema; //導入方法依賴的package包/類
private static Property addUserThreadLink(Schema schema){
    Property userThreadLinkId;
    userThreadLink = schema.addEntity(EntityProperties.UserThreadLink);
    userThreadLinkId = userThreadLink.addIdProperty().primaryKey().getProperty();


    // Link data for user and thread.
    setManyToMany(userThreadLink, user, thread);

    return userThreadLinkId;
}
 
開發者ID:MobileDev418,項目名稱:AndroidBackendlessChat,代碼行數:12,代碼來源:Generator.java

示例13: addUserInfo

import de.greenrobot.daogenerator.Schema; //導入方法依賴的package包/類
private static void addUserInfo(Schema schema) {
    Entity userInfo = schema.addEntity("UserEntity");
    userInfo.setTableName("UserInfo");
    userInfo.setClassNameDao("UserDao");
    userInfo.setJavaPackage(entityPath);

    userInfo.addIdProperty().autoincrement();
    userInfo.addIntProperty("peerId").unique().notNull().index();
    userInfo.addIntProperty("gender").notNull();
    userInfo.addStringProperty("mainName").notNull();
    // 這個可以自動生成pinyin
    userInfo.addStringProperty("pinyinName").notNull();
    userInfo.addStringProperty("realName").notNull();
    userInfo.addStringProperty("avatar").notNull();
    userInfo.addStringProperty("phone").notNull();
    userInfo.addStringProperty("email").notNull();
    userInfo.addIntProperty("departmentId").notNull();

    userInfo.addIntProperty("status").notNull();
    userInfo.addIntProperty("created").notNull();
    userInfo.addIntProperty("updated").notNull();

    userInfo.setHasKeepSections(true);

    //todo 索引還沒有設定
    // 一對一 addToOne 的使用
    // 支持protobuf
    // schema.addProtobufEntity();
}
 
開發者ID:ccfish86,項目名稱:sctalk,代碼行數:30,代碼來源:GreenDaoGenerator.java

示例14: addAppData

import de.greenrobot.daogenerator.Schema; //導入方法依賴的package包/類
private static void addAppData(Schema schema) {
    Entity tableName = schema.addEntity("AppData");

    tableName.addIdProperty().autoincrement();
    tableName.addStringProperty("appName");
    tableName.addStringProperty("appPackageName").unique();
    tableName.addLongProperty("lastModified");
    tableName.addIntProperty("isSystem");
}
 
開發者ID:WeiMei-Tian,項目名稱:editor-sql,代碼行數:10,代碼來源:ExampleDaoGenerator.java

示例15: addHistoryRecord

import de.greenrobot.daogenerator.Schema; //導入方法依賴的package包/類
private static void addHistoryRecord(Schema schema) {
    Entity tableName = schema.addEntity("HistoryData");

    tableName.addIdProperty().autoincrement();
    tableName.addStringProperty("name");
    tableName.addStringProperty("path").unique();
    tableName.addStringProperty("appName");
    tableName.addStringProperty("appPackageName");
    tableName.addLongProperty("size");
    tableName.addLongProperty("lastModified");
    tableName.addLongProperty("openTime");
}
 
開發者ID:WeiMei-Tian,項目名稱:editor-sql,代碼行數:13,代碼來源:ExampleDaoGenerator.java


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