Skip to content

Annotations

xcesco edited this page Jan 21, 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: indicates class is binded. You have to use this annotation if you decorate same class with a specific-format binding annotation (i.e.: @BindTypeXml).
  • @BindTypeXml: indicates a root XML element. It allow to define specific features valid only for xml format. If you define this annotation without @BindType, an exception will be throw.
  • @BindTable (Android platform): allow to define database name binded to annotated Java class.

##Annotations for interfaces##

Kripton decorate interface to create SQLite database, DAO and its queries 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.
  • @BindSharedPreferences (Android platform): allow to create a Shared Preference linked to annotated Java class.

##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: states field is binded. This contains generic information about field persistance.
  • @BindAdapter: allow to specify a custom type adapter 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: for a Java bean persisted on a SQLite database, this annotation allows to specify table column's features of a specific fields.

##Annotations for (interface) methods## There are some interface method's annotations:

  • @SqlSelect: create a method to execute a SELECT SQL.
  • @SqlInsert: create a method to execute a INSERT SQL.
  • @SqlUpdate: create a method to execute a UPDATE SQL.
  • @SqlDelete: create a method to execute a DELETE SQL.

##Annotations for (interface) method's parameters## There is only one annotations that you can use on method parameters:

  • @SqlParam: allow to define SQL parameter name.

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