This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
implementation 'com.github.AgustaRC.koap:koap:1.0.1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
repositories { | |
maven { url 'https://jitpack.io' } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>()) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface Account { | |
@NotNull | |
String getName(); | |
void setName(@NotNull String var1); | |
int getAge(); | |
void setAge(int var1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object AccountPreference : PreferenceHolder() { | |
var name: String by ReadWriteString(key = "pref_name", default = "leopold", predicate = { it.length > 2 }) | |
var age: Int by ReadWriteInt() | |
var hireable: Boolean by ReadWriteBoolean() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Preference | |
interface Account { | |
@PreferenceField(key = "pref_name", default = "leopold", predicate = { it.length > 2 }) | |
var name: String | |
var age: Int | |
var hireable: Boolean | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Point(val x: Double, val y: Double) { | |
companion object { | |
fun fromPolar(angle: Double, radius: Double) = Point(...) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
when (x) { | |
null -> ... | |
else -> ... | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (x) | |
return foo() | |
else | |
return bar() | |
when(x) { | |
0 -> return "zero" | |
else -> return "nonzero" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return if (x) foo() else bar() | |
return when(x) { | |
0 -> "zero" | |
else -> "nonzero" | |
} |