当前位置: 首页>>代码示例>>Java>>正文


Java Table类代码示例

本文整理汇总了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);
}
 
开发者ID:maskarade,项目名称:Android-Orma,代码行数:41,代码来源:SchemaDefinition.java

示例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());
    }
}
 
开发者ID:maskarade,项目名称:Android-Orma,代码行数:11,代码来源:SchemaValidator.java

示例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));
}
 
开发者ID:maskarade,项目名称:Android-Orma,代码行数:7,代码来源:OrmaProcessor.java


注:本文中的com.github.gfx.android.orma.annotation.Table类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。