EasyliteORM
Very simple Object Relationship Mapping framework (ORM) for Android.
Features
- Very minimal configuration.
- Annotation driven data modeling
- POJO Entity Classes that are loosely coupled
- Use of Data Access Objects for CRUD operations
- Asynchronous Operations
##Installation ####Gradle
compile 'com.easyliteorm:easyliteorm:1.2.0'
####Maven
<dependency>
<groupId>com.easyliteorm</groupId>
<artifactId>easyliteorm</artifactId>
<version>1.2.0</version> </dependency>
##Basic Setup #####Configuration Add information about datababse to AndroidManifest.xml
<application>
<meta-data android:name="DATABASE" android:value="dbname.db" />
<meta-data android:name="VERSION" android:value="1" />
<meta-data android:name="MODEL_PACKAGE_NAME" android:value="com.somepackagename.model" /> </application>
Define Entity Model
@Entity public class Note { @Id(strategy = GenerationType.AUTO) public int id; public String body; public String author; }
#####Usage Get singleton instance of EasyLite to create Data Access Object (DAO)
Dao<Integer, Note> dao = EasyLite.getInstance(context)
.getDao(Note.class);
Note note = new Note ();
dao.create(note);
List<Note> notes = dao.findAll();
#####Asynchronous Operation version 1.2.0 and greater
dao.findAllAsync(new ResponseListener<List<Note>>() {
@Override
public void onComplete(List<Note> result) {
// do something with result
}
}
);
###License The MIT License (MIT)
Copyright (c) 2015 Mario Dennis
http://www.opensource.org/licenses/mit-license.php
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: