Skip to content

Commit badd0a8

Browse files
committed
Merge branches 'dev' and 'master' of github.com:objectbox/objectbox-java
2 parents 9c15acb + 4d36e36 commit badd0a8

File tree

1 file changed

+32
-22
lines changed

1 file changed

+32
-22
lines changed

README.md

Lines changed: 32 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,46 +7,56 @@ ObjectBox is a superfast object-oriented database with strong relation support.
77

88
Demo 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

1517
Gradle setup
1618
------------
1719
Add 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+
3640
And 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

4046
First steps
4147
-----------
4248
Prepare 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

4654
Create data object class `@Entity`, for example "Playlist".
4755
Then 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

5161
The `Box` object gives you access to all major functions, like `put`, `get`, `remove`, and `query`.
5262

0 commit comments

Comments
 (0)