objectbox/objectbox-java

Additional Kotlin extensions

Open

#446 aperta il 14 mag 2018

Vedi su GitHub
 (9 commenti) (0 reazioni) (1 assegnatario)Java (348 fork)batch import
help wanted

Metriche repository

Star
 (4275 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

ObjectBox already provides some minimal Kotlin extensions:

// Regular
val box: Box<DataClassEntity> = store.boxFor(DataClassEntity::class.java)

// With extension
val box: Box<DataClassEntity> = store.boxFor()
// Regular
val query = box.query().`in`(property, array).build()

// With extension
val query = box.query().inValues(property, array).build()

This issue is to track what other Kotlin extensions may be added.

Some ground rules:

  • should leverage features unique to Kotlin
  • should not just be a shorter version of an existing method
  • should not optimize fur just a single use case

Things to look out for:

  • default args for methods
  • builder pattern
  • making util methods discoverable from the type they operate on
  • destructuring

-ut

Guida contributor