Search in sources :

Example 1 with StorIOSQLiteType

use of com.pushtorefresh.storio.sqlite.annotations.StorIOSQLiteType in project storio by pushtorefresh.

the class StorIOSQLiteProcessor method processAnnotatedClass.

/**
     * Processes annotated class.
     *
     * @param classElement type element annotated with {@link StorIOSQLiteType}
     * @param elementUtils utils for working with elementUtils
     * @return result of processing as {@link StorIOSQLiteTypeMeta}
     */
@NotNull
@Override
protected StorIOSQLiteTypeMeta processAnnotatedClass(@NotNull TypeElement classElement, @NotNull Elements elementUtils) {
    final StorIOSQLiteType storIOSQLiteType = classElement.getAnnotation(StorIOSQLiteType.class);
    final String tableName = storIOSQLiteType.table();
    if (tableName.length() == 0) {
        throw new ProcessingException(classElement, "Table name of " + classElement.getSimpleName() + " annotated with " + StorIOSQLiteType.class.getSimpleName() + " is empty");
    }
    final String simpleName = classElement.getSimpleName().toString();
    final String packageName = elementUtils.getPackageOf(classElement).getQualifiedName().toString();
    return new StorIOSQLiteTypeMeta(simpleName, packageName, storIOSQLiteType, classElement.getModifiers().contains(Modifier.ABSTRACT));
}
Also used : StorIOSQLiteTypeMeta(com.pushtorefresh.storio.sqlite.annotations.processor.introspection.StorIOSQLiteTypeMeta) StorIOSQLiteType(com.pushtorefresh.storio.sqlite.annotations.StorIOSQLiteType) ProcessingException(com.pushtorefresh.storio.common.annotations.processor.ProcessingException) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ProcessingException (com.pushtorefresh.storio.common.annotations.processor.ProcessingException)1 StorIOSQLiteType (com.pushtorefresh.storio.sqlite.annotations.StorIOSQLiteType)1 StorIOSQLiteTypeMeta (com.pushtorefresh.storio.sqlite.annotations.processor.introspection.StorIOSQLiteTypeMeta)1 NotNull (org.jetbrains.annotations.NotNull)1