Skip to content

Annotations

xcesco edited this page Nov 28, 2017 · 14 revisions

The binding rules are defined through Java annotations. In this section there's a brief description of annotations defined in Kripton.

Annotations for classes

You can decorate both class and field with generic and specific-format annotation. At class declaration's level it's possible to use the following annotation:

  • @BindType: allows to Kripton to manage a POJO. Given a class {name} generate a {name}BindMap class..
  • @BindTable (Android platform): allows to customize table generation associated to class.
  • @BindSharedPreferences (Android platform): allow to create a Shared Preference linked to annotated Java class.

Annotations for interfaces

Kripton decorate interface to create SQLite database, DAO, content provider and SharedPreference.

  • @BindDataSource (Android platform): defines a data source based on SQLite database.
  • @BindDao (Android platform): defines a DAO to manage a specific database's table.
  • @BindContentProvider: used to generated a content provider starting from data source declaration. Given an interface DataSource, it will generate ContentProvider class.
  • @BindContentProviderEntry: allow to use a specific DAO method in the generated content provider implementation.

Annotations for fields

You can decorate only fields. No setter or getter annotation is defined. You can decorate field regardless its accessor. The annotations are:

  • @Bind: allow to customize field’s persistence on file system.
  • @BindDisabled: disable field’s persistence.
  • @BindAdapter: allow to define which TypeAdapter use for a specific field. For example, @BindAdapter can be used to persit a Date field as a long.
  • @BindXml: contains informations about xml-persistence of field. It make possible to define how transform field in xml: tag, attribute or value of parent tag.
  • @BindColumn: allows to customize field persistence as table’s column.
  • @BindPreference: to customize field persistence as preference.

Annotations for (interface) methods

There are some interface method's annotations:

Annotations for (interface) method's parameters

There is only one annotations that you can use on method parameters:

  • @BindSqlParam: allow to define SQL parameter name.
  • @BindSqlDynamicWhere: allow to use a DAO’s method parameter as dynamic part of where clauses in SQL associated to method.
  • @BindSqlDynamicWhereParams: allow to use a DAO’s method parameter as dynamic parameters of where clauses in SQL associated to method.
  • @BindSqlDynamicOrderBy: allows to use a DAO’s method parameter as dynamic part of order by clauses in SQL associated to method.
  • @BindSqlPageSize: marks a parameter as pageSize for SQL results.

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