-
Notifications
You must be signed in to change notification settings - Fork 16
Annotation Processor Arguments
Kripton Processor Annotation accepts different options:
For Java Annotation Processor:
android {
defaultConfig {
applicationId "com.abubusoft.kripton.basicsample"
javaCompileOptions {
annotationProcessorOptions {
arguments = [
"kripton.debug" : "true",
"kripton.log" : "true",
"kripton.schemaLocation": "${projectDir}/schemas".toString(),
"kripton.schemaIncludeDate": "true"
]
}
}
}
For Kotlin Annotation Processor:
kapt {
arguments {
arg("kripton.debug", "true"),
arg("kripton.logger", "true"),
arg("kripton.schemaLocation","${projectDir}/schemas".toString()),
arg("kripton.schemaIncludeDate": "true")
}
}
The accepted arguments are:
If true, enable kripton log during annotations processor's execution. This log includes info about generated classes. An example:
w: Note: Kripton Persistence Library v. 5.0.0
w: Note: param kripton.androidx = <unset>
w: Note: jetpack live data support is disabled
w: Note: param kripton.schemaLocation = <unset>
w: Note: schemas location is 'd:\projects\xxx\KotlinSample01\schemas'
w: Note: class 'ArticleBindMap' in package 'com.abubusoft.kripton.kotlin.sample01.model'
is generated by '@BindType' annotation processor
w: Note: class 'ChannelBindMap' in package 'com.abubusoft.kripton.kotlin.sample01.model'
is generated by '@BindType' annotation processor
...
The default value is false
.
It allows specifying in which folder are generated DataSource schemas. If not defined, the default folder <project-dir>/schemas
will be used. Otherwise, you can specify another folder (relative to the project folder).
The default value is "${projectDir}/schemas".toString()
.
This argument is true
, allow to include in the generated schema file the date of generation. If false
, no date is inserted in file.
------------------------------------------------------------------------------------
--
-- Filename: app_schema_1.sql
-- Generated by: kripton annotation processor 8.2.0-rc.4
-- Date: Wed Jan 04 15:37:10 CET 2023
--
------------------------------------------------------------------------------------
CREATE TABLE user (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, name TEXT)
The default value is true
. Since version 8.2.0-rc.4.
This arguments
, if it set as false
, avoid that annotation processor generates log code. This is mainly used for ORM module. This argument override all data source's configuration on log configuration.
Just an example:
@BindDataSourceOptions(logEnabled = true,
populator = PersonPopulator.class,
cursorFactory = PersonCursorFactory.class,
databaseLifecycleHandler = PersonLifecycleHandler.class,
updateTasks = {
@BindDataSourceUpdateTask(version = 2, task = PersonUpdateTask.class)
})
@BindDataSource(daoSet = { DaoPerson.class }, fileName = "app.db" , log=true)
public interface AppWithConfigDataSource {
}
With this configuration, Kritpon for default will generate log statements as usual. If you want to disable log code generation just configure the annotation processor with:
javaCompileOptions {
annotationProcessorOptions {
arguments = [
"kripton.log" : "false"
]
}
}
It's particularly useful when you want to generate a release apk and you need to control logs generation in a centralized way.
Since version 6.0.0
The default value is true
.
- Introduction
- Goals & Features
- Kotlin
- Immutable or Mutable Pojo
- Annotation Processor Args
- Credits
- Articles
- Benchmarks
- Setup
- Tutorial
- Usage
- Dependencies and inspirations
- Stackoverflow
- Documentation
- SQL logging
- Data source options
- Indices
- SQL Type adapter
- Global SQL Type adapter
- Constraints
- Live data: welcome Architectural components!!
- Paged Live data
- Dynamic parts
- Transactional and batch operations
- Async Transactional and batch operations
- Global transaction
- Support for immutable POJO
- Generate Content provider
- Generate Database schema generation
- Database migration
- BindSqlColumn
- BindContentProvider
- BindContentProviderEntry
- BindContentProviderPath
- BindDao
- BindDaoMany2Many
- BindDataSource
- BindDataSourceOptions
- BindDataSourceUpdateTask
- BindIndex
- BindSqlRelation
- BindSqlAdapter
- BindSqlChildSelect
- BindSqlDelete
- BindSqlDynamicOrderBy
- BindSqlDynamicWhere
- BindSqlDynamicWhereParams
- BindSqlInsert
- BindSqlPageSize
- BindSqlParam
- BindSqlSelect
- BindSqlUpdate
- BindSqlType
- BindSqlTransaction