@@ -7,46 +7,56 @@ ObjectBox is a superfast object-oriented database with strong relation support.
77
88Demo code using ObjectBox:
99
10- Playlist playlist = new Playlist("My Favorties");
11- playlist.songs.add(new Song("Lalala"));
12- playlist.songs.add(new Song("Lololo"));
13- box.put(playlist);
10+ ``` java
11+ Playlist playlist = new Playlist (" My Favorties" );
12+ playlist. songs. add(new Song (" Lalala" ));
13+ playlist. songs. add(new Song (" Lololo" ));
14+ box. put(playlist);
15+ ```
1416
1517Gradle setup
1618------------
1719Add this to your root build.gradle (project level):
1820
19- buildscript {
20- ext.objectboxVersion = '1.3.4'
21- repositories {
22- maven { url "http://objectbox.net/beta-repo/" }
23- }
24- dependencies {
25- classpath "io.objectbox:objectbox-gradle-plugin:$objectboxVersion"
26- }
27-
21+ ``` groovy
22+ buildscript {
23+ ext.objectboxVersion = '1.3.4'
24+ repositories {
25+ maven { url "http://objectbox.net/beta-repo/" }
2826 }
29-
30- allprojects {
31- repositories {
32- maven { url "http://objectbox.net/beta-repo/" }
33- }
27+ dependencies {
28+ classpath "io.objectbox:objectbox-gradle-plugin:$objectboxVersion"
3429 }
3530
31+ }
32+
33+ allprojects {
34+ repositories {
35+ maven { url "http://objectbox.net/beta-repo/" }
36+ }
37+ }
38+ ```
39+
3640And this to our app's build.gradle (module level):
3741
38- apply plugin: 'io.objectbox' // after applying Android plugin
42+ ``` groovy
43+ apply plugin: 'io.objectbox' // after applying Android plugin
44+ ```
3945
4046First steps
4147-----------
4248Prepare the BoxStore object once for your app, e.g. in ` onCreate ` in your Application class:
4349
44- boxStore = MyObjectBox.builder().androidContext(this).build();
50+ ``` java
51+ boxStore = MyObjectBox . builder(). androidContext(this ). build();
52+ ```
4553
4654Create data object class ` @Entity ` , for example "Playlist".
4755Then get a ` Box ` class for this entity class:
48-
49- Box<Playlist > box = boxStore.boxFor(Playlist.class);
56+
57+ ``` java
58+ Box<Playlist > box = boxStore. boxFor(Playlist . class);
59+ ```
5060
5161The ` Box ` object gives you access to all major functions, like ` put ` , ` get ` , ` remove ` , and ` query ` .
5262
0 commit comments