Skip to content

V3.1.0

Compare
Choose a tag to compare
@greenrobot-team greenrobot-team released this 10 Jan 13:01
· 328 commits to main since this release

Read the blog post with more details and code examples for the new flex properties and query conditions.

  • Support Flex properties. Expanding on the string and flexible map support in 3.0.0, it is now possible to add a property using Object in Java or Any? in Kotlin. These "flex properties" now allow to store values of various types like integers, floating point values, strings and byte arrays. Or lists and maps (using string keys) of those. Some limitations apply, see the FlexObjectConverter class documentation for details.
    @Entity
    data class Customer(
        @Id var id: Long = 0,
        var tag: Any? = null
    )
    
    val customerStrTag = Customer(tag = "string-tag")
    val customerIntTag = Customer(tag = 1234)
    box.put(customerStrTag, customerIntTag)
  • The containsElement query condition now matches keys of string map properties. It also matches string or integer elements of a Flex list.
  • New containsKeyValue query condition to match key/value combinations of string map and Flex map properties containing strings and integers. Also added matching Query.setParameters overload.
    val customer = Customer(
        properties = mutableMapOf("premium" to "tier-1")
    )
    box.put(customer)
    
    // Query for any customers that have a premium key in their properties map
    val queryPremiumAll = box.query(
        Customer_.properties.containsElement("premium")
    ).build()
    
    // Match only customers with specific key and value map entry
    val queryPremiumTier1 = box.query(
        Customer_.properties.containsKeyValue("premium", "tier-1")
    ).build()
  • Add ProGuard/R8 rule to not warn about SuppressFBWarnings annotation. #1011
  • Add more detailed error message when loading the native library fails on Android. #1024
  • Data browser: byte arrays are now correctly displayed in Base64 encoding. #1033

Kotlin

  • Add BoxStore.awaitCallInTx suspend function which wraps BoxStore.callInTx.

Gradle plugin

  • Do not crash trying to add dependencies to Java desktop projects that only apply the Gradle application plugin.

Read more in the docs