本文整理汇总了Java中org.greenrobot.greendao.generator.Schema类的典型用法代码示例。如果您正苦于以下问题:Java Schema类的具体用法?Java Schema怎么用?Java Schema使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Schema类属于org.greenrobot.greendao.generator包,在下文中一共展示了Schema类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TestDaoGenerator
import org.greenrobot.greendao.generator.Schema; //导入依赖的package包/类
public TestDaoGenerator() {
schema = new Schema(1, "org.greenrobot.greendao.daotest");
schema.setDefaultJavaPackageTest("org.greenrobot.greendao.daotest.entity");
createSimple();
createSimpleNotNull();
testEntity = createTest();
createRelation();
dateEntity = createDate();
createSpecialNames();
createAbcdef();
createToMany();
createTreeEntity();
createActive();
createExtendsImplements();
createStringKeyValue();
createAutoincrement();
createSqliteMaster();
createCustomType();
createIndexedString();
schema2 = createSchema2();
schemaUnitTest = createSchemaUnitTest();
}
示例2: main
import org.greenrobot.greendao.generator.Schema; //导入依赖的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();
}
}
示例3: addTraceRepo
import org.greenrobot.greendao.generator.Schema; //导入依赖的package包/类
private static void addTraceRepo(Schema schema){
Entity entity = schema.addEntity("TraceRepo");
entity.addLongProperty("id").primaryKey().notNull();
entity.addStringProperty("name").notNull();
entity.addStringProperty("description");
entity.addStringProperty("language");
entity.addIntProperty("stargazersCount");
entity.addIntProperty("watchersCount");
entity.addIntProperty("forksCount");
entity.addBooleanProperty("fork");
entity.addStringProperty("ownerLogin");
entity.addStringProperty("ownerAvatarUrl");
entity.addDateProperty("startTime");
entity.addDateProperty("latestTime");
entity.addIntProperty("traceNum");
}
示例4: addBookMarkRepo
import org.greenrobot.greendao.generator.Schema; //导入依赖的package包/类
private static void addBookMarkRepo(Schema schema){
Entity entity = schema.addEntity("BookMarkRepo");
entity.addLongProperty("id").primaryKey().notNull();
entity.addStringProperty("name").notNull();
entity.addStringProperty("description");
entity.addStringProperty("language");
entity.addIntProperty("stargazersCount");
entity.addIntProperty("watchersCount");
entity.addIntProperty("forksCount");
entity.addBooleanProperty("fork");
entity.addStringProperty("ownerLogin");
entity.addStringProperty("ownerAvatarUrl");
entity.addDateProperty("markTime");
}
示例5: generateSchemas
import org.greenrobot.greendao.generator.Schema; //导入依赖的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
示例6: main
import org.greenrobot.greendao.generator.Schema; //导入依赖的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();
}
}
示例7: main
import org.greenrobot.greendao.generator.Schema; //导入依赖的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());
}
示例8: addPgeG11Bill
import org.greenrobot.greendao.generator.Schema; //导入依赖的package包/类
private static void addPgeG11Bill(Schema schema, final Entity pgePrices) {
Entity pgeBill = schema.addEntity("PgeG11Bill");
pgeBill.implementsInterface("Bill");
pgeBill.addIdProperty().autoincrement();
pgeBill.addIntProperty("readingFrom");
pgeBill.addIntProperty("readingTo");
pgeBill.addDateProperty("dateFrom");
pgeBill.addDateProperty("dateTo");
pgeBill.addDoubleProperty("amountToPay");
Property pricesId = pgeBill.addLongProperty("pricesId").getProperty();
pgeBill.addToOne(pgePrices, pricesId);
}
示例9: addPgeG12Bill
import org.greenrobot.greendao.generator.Schema; //导入依赖的package包/类
private static void addPgeG12Bill(final Schema schema, final Entity pgePrices) {
Entity pgeBill = schema.addEntity("PgeG12Bill");
pgeBill.implementsInterface("Bill");
pgeBill.addIdProperty().autoincrement();
pgeBill.addIntProperty("readingDayFrom");
pgeBill.addIntProperty("readingDayTo");
pgeBill.addIntProperty("readingNightFrom");
pgeBill.addIntProperty("readingNightTo");
pgeBill.addDateProperty("dateFrom");
pgeBill.addDateProperty("dateTo");
pgeBill.addDoubleProperty("amountToPay");
Property pricesId = pgeBill.addLongProperty("pricesId").getProperty();
pgeBill.addToOne(pgePrices, pricesId);
}
示例10: addPgePrices
import org.greenrobot.greendao.generator.Schema; //导入依赖的package包/类
private static Entity addPgePrices(final Schema schema) {
Entity pgePrices = schema.addEntity("PgePrices");
pgePrices.implementsInterface("pl.srw.billcalculator.pojo.IPgePrices");
pgePrices.implementsSerializable();
pgePrices.addIdProperty().autoincrement();
pgePrices.addStringProperty("zaEnergieCzynna");
pgePrices.addStringProperty("skladnikJakosciowy");
pgePrices.addStringProperty("oplataSieciowa");
pgePrices.addStringProperty("oplataPrzejsciowa");
pgePrices.addStringProperty("oplataStalaZaPrzesyl");
pgePrices.addStringProperty("oplataAbonamentowa");
pgePrices.addStringProperty("zaEnergieCzynnaDzien");
pgePrices.addStringProperty("zaEnergieCzynnaNoc");
pgePrices.addStringProperty("oplataSieciowaDzien");
pgePrices.addStringProperty("oplataSieciowaNoc");
pgePrices.addStringProperty("oplataOze");
return pgePrices;
}
示例11: addPgnigBill
import org.greenrobot.greendao.generator.Schema; //导入依赖的package包/类
private static void addPgnigBill(final Schema schema, final Entity pgnigPrices) {
Entity pgnigBill = schema.addEntity("PgnigBill");
pgnigBill.implementsInterface("Bill");
pgnigBill.addIdProperty();
pgnigBill.addIntProperty("readingFrom");
pgnigBill.addIntProperty("readingTo");
pgnigBill.addDateProperty("dateFrom");
pgnigBill.addDateProperty("dateTo");
pgnigBill.addDoubleProperty("amountToPay");
Property pricesId = pgnigBill.addLongProperty("pricesId").getProperty();
pgnigBill.addToOne(pgnigPrices, pricesId);
}
示例12: addTauronG11Bill
import org.greenrobot.greendao.generator.Schema; //导入依赖的package包/类
private static void addTauronG11Bill(final Schema schema, final Entity tauronPrices) {
Entity bill = schema.addEntity("TauronG11Bill");
bill.implementsInterface("Bill");
bill.addIdProperty().autoincrement();
bill.addIntProperty("readingFrom");
bill.addIntProperty("readingTo");
bill.addDateProperty("dateFrom");
bill.addDateProperty("dateTo");
bill.addDoubleProperty("amountToPay");
Property pricesId = bill.addLongProperty("pricesId").getProperty();
bill.addToOne(tauronPrices, pricesId);
}
示例13: addTauronG12Bill
import org.greenrobot.greendao.generator.Schema; //导入依赖的package包/类
private static void addTauronG12Bill(final Schema schema, final Entity tauronPrices) {
Entity bill = schema.addEntity("TauronG12Bill");
bill.implementsInterface("Bill");
bill.addIdProperty().autoincrement();
bill.addIntProperty("readingDayFrom");
bill.addIntProperty("readingDayTo");
bill.addIntProperty("readingNightFrom");
bill.addIntProperty("readingNightTo");
bill.addDateProperty("dateFrom");
bill.addDateProperty("dateTo");
bill.addDoubleProperty("amountToPay");
Property pricesId = bill.addLongProperty("pricesId").getProperty();
bill.addToOne(tauronPrices, pricesId);
}
示例14: addTauronPrices
import org.greenrobot.greendao.generator.Schema; //导入依赖的package包/类
private static Entity addTauronPrices(final Schema schema) {
Entity prices = schema.addEntity("TauronPrices");
prices.implementsInterface("pl.srw.billcalculator.pojo.ITauronPrices");
prices.implementsSerializable();
prices.addIdProperty().autoincrement();
prices.addStringProperty("energiaElektrycznaCzynna");
prices.addStringProperty("oplataDystrybucyjnaZmienna");
prices.addStringProperty("oplataDystrybucyjnaStala");
prices.addStringProperty("oplataPrzejsciowa");
prices.addStringProperty("oplataAbonamentowa");
prices.addStringProperty("energiaElektrycznaCzynnaDzien");
prices.addStringProperty("energiaElektrycznaCzynnaNoc");
prices.addStringProperty("oplataDystrybucyjnaZmiennaDzien");
prices.addStringProperty("oplataDystrybucyjnaZmiennaNoc");
prices.addStringProperty("oplataOze");
return prices;
}
示例15: createSchema2
import org.greenrobot.greendao.generator.Schema; //导入依赖的package包/类
private Schema createSchema2() {
Schema schema2 = new Schema(1, "org.greenrobot.greendao.daotest2");
schema2.setDefaultJavaPackageTest("org.greenrobot.greendao.daotest2.entity");
schema2.setDefaultJavaPackageDao("org.greenrobot.greendao.daotest2.dao");
schema2.enableKeepSectionsByDefault();
Entity keepEntity = schema2.addEntity("KeepEntity");
keepEntity.addIdProperty();
Entity toManyTarget2 = schema2.addEntity("ToManyTarget2");
toManyTarget2.addIdProperty();
Property toManyTarget2FkId = toManyTarget2.addLongProperty("fkId").getProperty();
toManyTarget2.setSkipGenerationTest(true);
Entity toOneTarget2 = schema2.addEntity("ToOneTarget2");
toOneTarget2.addIdProperty();
toOneTarget2.setJavaPackage("org.greenrobot.greendao.daotest2.to1_specialentity");
toOneTarget2.setJavaPackageDao("org.greenrobot.greendao.daotest2.to1_specialdao");
toOneTarget2.setJavaPackageTest("org.greenrobot.greendao.daotest2.to1_specialtest");
toOneTarget2.setSkipGenerationTest(true);
Entity relationSource2 = schema2.addEntity("RelationSource2");
relationSource2.addIdProperty();
relationSource2.addToMany(toManyTarget2, toManyTarget2FkId);
Property toOneId = relationSource2.addLongProperty("toOneId").getProperty();
relationSource2.addToOne(toOneTarget2, toOneId);
relationSource2.setJavaPackage("org.greenrobot.greendao.daotest2.specialentity");
relationSource2.setJavaPackageDao("org.greenrobot.greendao.daotest2.specialdao");
relationSource2.setJavaPackageTest("org.greenrobot.greendao.daotest2.specialtest");
relationSource2.setSkipGenerationTest(true);
return schema2;
}