• Stars
    star
    102
  • Rank 335,584 (Top 7 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created over 9 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Gradle plugin for Android to generate an ORMLite configuration file and boost DAOs creations.

ORM Lite Android Gradle Plugin Build StatusMaven Central

A Gradle plugin for Android to generate an ORMLite configuration file and boost DAOs creations.

As of version 1.0.13, ORM GAP is fully incremental and gets executed only when classes using ormlite change.

Usage

//build.gradle

buildscript {
  repositories {
    ...
    mavenCentral()
  }

  dependencies {
    ...
    classpath 'com.github.stephanenicolas.ormgap:ormgap-plugin:x.y.z'
  }
}

apply plugin: 'android'
apply plugin: 'ormgap'
...

You will then need to create your database using the ORMLite config file that will be generated during your build (note : you first need to boostrap the system, get a file generated, then reference it.)

public DatabaseHelper(Context context) {
    super(context, DATABASE_NAME, null, DATABASE_VERSION, R.raw.ormlite_config);
}

If you use DAOs : you will need to use the second contructor of ORMLite's DAO class :

public MyDao(ConnectionSource connectionSource, DatabaseTableConfig tableConfig)
   throws SQLException {
   super(connectionSource, tableConfig);
}

You're all set. See ORM Lite docs for further instructions.

Example

An example can be found in the GH repo.

How does it work ?

We basically just automated a technique that is considered the best practice for ORM Lite on Android : it uses a configuration file, genereated at build time, so that ORMLite doesn't scan annotations.

ORMGAP will do the following to your build :

  • create a task for each variant to generate the ORMLite configuration file (this is customizable, TODO explain the plugin extension).
  • we also add a provided dependency to your build that contains our forked utility class. This should disappear in a close future, as soon as we submit a PR to ORM Lite and a new version is released... TODO : submit a PR with ORMLiteConfigUtil changes.

Benchmarking

Our plan is to make a benchmarking app using the example android app.

For now, we can only give you a number from our experience at Groupon: the average gain, for all devices of our 50 million users is 10 ms per DAO creation. It might not seem much, but for large apps, it makes a difference. In our app, we gained 400 ms with ORMGAP.

CI

Travis is almost ready at : https://travis-ci.org/stephanenicolas/ormlite-android-gradle-plugin

Credits

ORMGAP has been possible thanks to Groupon !

Groupon logo

And, yes, we are hiring Android coders.

ORMGAP is part of our open source effort.

License

Copyright (C) 2015 Stéphane NICOLAS

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

More Repositories

1

robospice

Repo of the Open Source Android library : RoboSpice. RoboSpice is a modular android library that makes writing asynchronous long running tasks easy. It is specialized in network requests, supports caching and offers REST requests out-of-the box using extension modules.
Java
2,946
star
2

Quality-Tools-for-Android

Java
1,266
star
3

toothpick

A scope tree based Dependency Injection (DI) library for Java / Kotlin / Android.
Java
1,123
star
4

boundbox

BoundBox provides an easy way to test an object by accessing all its fields, constructor and methods, public or not. BoundBox breaks encapsulation.
Java
229
star
5

RoboDemo

RoboDemo is a ShowCase library for Android to demonstrate to users how a given Activity works.
Java
215
star
6

loglifecycle

Logs all lifecycle methods of annotated Activities, Fragments, Services, Views, etc.
Java
206
star
7

reflection-no-reflection

A proof on concept to create an API that is 100% compatible reflection API, but without any reflection. Performance stuff for Android and Java.
Java
130
star
8

morpheus

An Android gradle plugin to transform classes via javassist.
Java
80
star
9

afterburner

A library to help other librairies getting rid of boiler plate via byte code manipulation. Works on Android too.
Java
74
star
10

injectextra

Injects everything passed by extra to an activity automatically.
Java
26
star
11

androidstudio4maccheatsheet

Most useful keyboard shortcuts with default keymap in Android Studio.
23
star
12

mimic

Mimicing is, indeed, kind of way to bypass java single inheritance paradigm. It allows to copy all declared fields, constructors and methods in a given class into another class.
Java
19
star
13

activtity-fragment-lambda

Example of how to use lambdas to communicate between Fragments and Activities
Java
17
star
14

injectview

On Android, Injects all views inflated from XML automatically. No boiler plate at all.
Java
17
star
15

injects

This repo is a control center for the injects projects.
9
star
16

injectresource

Inject resources automatically on Android.
Java
8
star
17

javassist-build-plugin-api

A unified API to create class transformers based on javassist during maven and gradle builds.
Java
7
star
18

TypedAdapter

Object Oriented android list view adapter(s) using generics to display given Pojos.
Java
5
star
19

google-guice

A fork of Google Guice to allow RoboGuice to go faster at startup.
Java
3
star
20

zest-android

Sample app to demonstrate roboguice usage + testing
Java
3
star
21

Dependency-Resources-Linearization

Demonstrate that the linearization of the dependency graph that gives to the order of priority to aapt2 when merging resources is hard to grasp for humans and that we can quickly have problems when scaling the number of modules.
Kotlin
3
star
22

MixedServiceLifeCycle-sample

A sample to demonstrate that a mixed life cycle service (both started and bound) is buggy. Built for a common guy ;)
Java
2
star
23

heatControl

Controls a custom micro controller on a heating system
Kotlin
1
star
24

bugs-instant-execution

Sample project to illustrate instant execution bugs in Android projects
Shell
1
star