|
| 1 | +# ObjectBox Java (Kotlin, Android) |
| 2 | +ObjectBox is a superfast object-oriented database with strong relation support. |
| 3 | + |
| 4 | +**Latest version: [1.0.0 (2017/09/04)](http://objectbox.io/changelog)** |
| 5 | + |
| 6 | +Demo code using ObjectBox: |
| 7 | + |
| 8 | + Playlist playlist = new Playlist("My Favorties"); |
| 9 | + playlist.songs.add(new Song("Lalala"); |
| 10 | + playlist.songs.add(new Song("Lololo"); |
| 11 | + box.put(playlist); |
| 12 | + |
| 13 | +Gradle setup |
| 14 | +------------ |
| 15 | +Add this to your root build.gradle (project level): |
| 16 | + |
| 17 | + buildscript { |
| 18 | + ext.objectboxVersion = '1.0.0' |
| 19 | + repositories { |
| 20 | + maven { url "http://objectbox.net/beta-repo/" } |
| 21 | + } |
| 22 | + dependencies { |
| 23 | + classpath "io.objectbox:objectbox-gradle-plugin:$objectboxVersion" |
| 24 | + } |
| 25 | + |
| 26 | + } |
| 27 | + |
| 28 | + allprojects { |
| 29 | + repositories { |
| 30 | + maven { url "http://objectbox.net/beta-repo/" } |
| 31 | + } |
| 32 | + } |
| 33 | + |
| 34 | +And this to our app's build.gradle (module level): |
| 35 | + |
| 36 | + apply plugin: 'io.objectbox' // after applying Android plugin |
| 37 | + |
| 38 | +First steps |
| 39 | +----------- |
| 40 | +Prepare the BoxStore object once for your app, e.g. in `onCreate` in your Application class: |
| 41 | + |
| 42 | + boxStore = MyObjectBox.builder().androidContext(this).build(); |
| 43 | + |
| 44 | +Create data object class `@Entity`, for example "Playlist". |
| 45 | +Then get a `Box` class for this entity class: |
| 46 | + |
| 47 | + Box<Playlist> box = boxStore.boxFor(Playlist.class); |
| 48 | + |
| 49 | +The `Box` object gives you access to all major functions, like `put`, `get`, `remove`, and `query`. |
| 50 | + |
| 51 | +For details please check the [docs](http://objectbox.io/documentation/). |
| 52 | + |
| 53 | +Links |
| 54 | +----- |
| 55 | +[Features](http://objectbox.io/features/) |
| 56 | + |
| 57 | +[Documentation](http://objectbox.io/documentation/) |
| 58 | + |
| 59 | +[Examples](https://github.com/objectbox/objectbox-examples) |
| 60 | + |
| 61 | +[Changelog](http://objectbox.io/changelog/) |
| 62 | + |
| 63 | +We love to get your feedback |
| 64 | +---------------------------- |
| 65 | +Let us know how we are doing: [2 minute questionnaire](https://docs.google.com/forms/d/e/1FAIpQLSe_fq-FlBThK_96bkHv1oEDizoHwEu_b6M4FJkMv9V5q_Or9g/viewform?usp=sf_link). |
| 66 | +Thanks! |
| 67 | + |
| 68 | + |
| 69 | +License |
| 70 | +------- |
| 71 | + Copyright 2017 ObjectBox Ltd. All rights reserved. |
| 72 | + |
| 73 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 74 | + you may not use this file except in compliance with the License. |
| 75 | + You may obtain a copy of the License at |
| 76 | + |
| 77 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 78 | + |
| 79 | + Unless required by applicable law or agreed to in writing, software |
| 80 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 81 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 82 | + See the License for the specific language governing permissions and |
| 83 | + limitations under the License. |
| 84 | + |
0 commit comments