本文整理汇总了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");
}
示例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);
}
示例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");
}
示例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();
}
示例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();
}
}
}
}
}
}
示例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");
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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");
}
示例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");
}
示例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");
}
示例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");
}