Skip to content

Instantly share code, notes, and snippets.

@agustarc
Created April 30, 2019 01:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agustarc/e7c05209b7d65735d04ccb86998bbcf9 to your computer and use it in GitHub Desktop.
Save agustarc/e7c05209b7d65735d04ccb86998bbcf9 to your computer and use it in GitHub Desktop.
object AccountPreference : PreferenceHolder(name = "account", cacheStrategy = CacheStrategy.LAZY) {
var name: String by ReadWriteString(predicate = { it.length > 2 })
var age: Int by ReadWriteInt(default = 1, caching = false)
var hireable: Boolean by ReadWriteBoolean()
var score: Float by ReadWriteFloat(default = 0.1f)
var repos: Long by ReadWriteLong()
var followers: ArrayList<User>? by ReadWriteSerializable(type = inferType<ArrayList<User>>())
var friend: User? by ReadWriteSerializable(type = inferType<User>())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment