objectbox/objectbox-java

Additional Kotlin extensions

开放

#446 创建于 2018年5月14日

 (9 条评论) (0 个反应) (1 位负责人)Java (348 个派生)batch import
help wanted

仓库指标

星标
 (4,275 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

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

贡献者指南