本文整理汇总了Java中com.github.gfx.android.orma.annotation.Table类的典型用法代码示例。如果您正苦于以下问题:Java Table类的具体用法?Java Table怎么用?Java Table使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Table类属于com.github.gfx.android.orma.annotation包,在下文中一共展示了Table类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SchemaDefinition
import com.github.gfx.android.orma.annotation.Table; //导入依赖的package包/类
public SchemaDefinition(ProcessingContext context, TypeElement typeElement) {
this.context = context;
this.typeElement = typeElement;
this.modelClassName = ClassName.get(typeElement);
this.generic = !typeElement.getTypeParameters().isEmpty();
Table table = typeElement.getAnnotation(Table.class);
this.constraints = table.constraints();
this.schemaClassName = helperClassName(table.schemaClassName(), modelClassName, "_Schema");
this.relationClassName = helperClassName(table.relationClassName(), modelClassName, "_Relation");
this.selectorClassName = helperClassName(table.selectorClassName(), modelClassName, "_Selector");
this.updaterClassName = helperClassName(table.updaterClassName(), modelClassName, "_Updater");
this.deleterClassName = helperClassName(table.deleterClassName(), modelClassName, "_Deleter");
this.associationConditionClassName = helperClassName(
table.associationConditionClassName(), modelClassName, "_AssociationCondition");
this.tableName = firstNonEmptyName(table.value(), modelClassName.simpleName());
this.constructorElement = findSetterConstructor(context, typeElement);
columns = collectColumns(typeElement);
// Places primaryKey as the last in columns to handle withoutAutoId.
// See also the bindArgs() generator in SchemaWriter.
columns.sort((a, b) -> {
if (a.primaryKey) {
return 1;
} else if (b.primaryKey) {
return -1;
}
return 0;
});
this.primaryKey = findPrimaryKey(columns);
this.indexes = Stream.concat(
Stream.of(table.indexes()).map(this::createIndexDefinition),
extractIndexes()
).collect(Collectors.toList());
SchemaValidator.validate(context, this);
}
示例2: validateNoOrmaModelInInheritance
import com.github.gfx.android.orma.annotation.Table; //导入依赖的package包/类
private void validateNoOrmaModelInInheritance(TypeMirror type) {
TypeElement t = context.getTypeElement(type);
if (t.getAnnotation(Table.class) != null) {
error("The superclasses of Orma models are not allowed to have @Table annotation", t);
}
if (!t.toString().equals(Object.class.getCanonicalName())) {
validateNoOrmaModelInInheritance(t.getSuperclass());
}
}
示例3: buildTableSchemas
import com.github.gfx.android.orma.annotation.Table; //导入依赖的package包/类
public Stream<SchemaDefinition> buildTableSchemas(ProcessingContext context, RoundEnvironment roundEnv) {
return roundEnv
.getElementsAnnotatedWith(Table.class)
.stream()
.map(element -> new SchemaDefinition(context, (TypeElement) element));
}