Android Persistence Library
Compiler plugin for persistence layer and interprocess communication on Android
We provide a source-code generator for the Java and Android eco-system that enhances a given datamodel by database and peer-class functionality without the need of an additional library. This is done by class templates that are transformed to autogenerated code at compile time.
The application integrates with existing gradle and maven build environments and generates code with a clean interface for use within your application.
It is possible to create
- SQLite database objects
- Android DataProvider implementations that use the underlying schema
- Parcelable code
The library is aware of combined primary key definitions, foreign key handling, embedded entities and database versioning for definition updates. All model definitions are done by source-only Annotations and create light-weight plain code without requiring any additional library dependency.
Android Room
The system has some benefits and drawbacks when compared to the room persistence library, it is currently not a source-compatible room alternative but is based on the same principle of autogenerated code which directly utilizes the SQLite API.
We have several aspects of the Room persistence library on the developer roadmap for upcoming versions, see a comparison of features below:
Supported by our library
- It has support for foreign key handling with combined key fields
- Versioned databases are very intuitive by setting an integer version on the annotation of the new item
which may be either a field or class, the system then automatically handles upgrades - Primary keys which may also consist of multiple fields
- Embedded objects with prefixes
Differences to the Room Persistence library
- It currently does not support a query language as provided by Android Room;
Instead constants are created that also reflect join correlations and make it easy to construct native queries
(see the JOIN_CUSTOMER constant for an example on how Seife solves this) - Room assumes all fields are persisted unless the @Ignore annotation is added
this lib will only persist fields annotated with @SeifeField (see e.g. Example 1) - It does not have a RoomDatabase instance which is fairly costly,
instead a class extending from DbOpenHelper is created - No type converter is available yet, instead the conversion is performed inline in the generated read methods
- There is no support for explicit definition of SQLite collations
What’s exceptional for the seife code generator
- On-the-fly creation of DataProvider classes accessing the underlying SQLite database
- Support to also create code for the parcelable interface
allows for interprocess communication via the Android binder bridge and remote service calls with complex datatypes (.aidl)
We are always open for suggestions on improving the library and adding new functionality, so don’t hesitate to contact us if you have any questions
Our persistence library helps developers to write energy- and time-efficient code, reduces the need of writing error-prone boilerplate code and saves a lot of time so you can focus on your project.