Skip to content

Annotation Processor Arguments

xcesco edited this page Apr 17, 2020 · 8 revisions

Kripton Processor Annotation accepts different options:

For Java Annotation Processor:

android {
  
  defaultConfig {
    applicationId "com.abubusoft.kripton.basicsample"
    
    javaCompileOptions {
      annotationProcessorOptions {
        arguments = [
          "kripton.androidx"      : "true"
          "kripton.debug"         : "true",
          "kripton.log"           : "true",
          "kripton.schemaLocation": "${projectDir}/schemas".toString()
        ]
    }
  }
}

For Kotlin Annotation Processor:

kapt {
   arguments {
     arg("kripton.androidx", "true"),
     arg("kripton.debug", "true"),
     arg("kripton.logger", "true"),
     arg("kripton.schemaLocation","${projectDir}/schemas".toString())
   }
}

The accepted arguments are:

kripton.debug = "true"/"false"

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.

kripton.androidx = "true"/"false"

Kripton, for the moment use arch.LiveData to manage Live Data. If you need to use androidx.Live data instead, simply put this parameter to true.

The default value is false.

kripton.schemaLocation

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().

kripton.log = "true"/"false" (default true)

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.

Table of Contents

Query definition

Features

Relations

Multithread supports

Modularization

Annotations for data convertion

Annotations for SQLite ORM

Annotations for shared preferences

Clone this wiki locally