- 授权协议: Apache
- 开发语言: Kotlin
- 操作系统: 跨平台
- 软件首页: https://github.com/valiktor/valiktor
- 软件文档: https://github.com/valiktor/valiktor/blob/master/README.md
- 官方下载: https://github.com/valiktor/valiktor/releases
软件介绍
Valiktor 是一个类型安全、功能强大且可扩展的流畅 DSL,用于验证 Kotlin 中的对象。
安装
Gradle (Groovy):
compile 'org.valiktor:valiktor-core:0.3.1'
Gradle (Kotlin DSL):
compile("org.valiktor:valiktor-core:0.3.1")Maven:
<dependency> <groupId>org.valiktor</groupId> <artifactId>valiktor-core</artifactId> <version>0.3.1</version> </dependency>
For install other modules, see Modules.
开始使用
import org.valiktor.validate
import org.valiktor.functions.*
data class Employee(val id: Int, val name: String, val email: String) {
init {
validate(this) {
validate(Employee::id).isPositive()
validate(Employee::name).isNotBlank().hasSize(min = 1, max = 80)
validate(Employee::email).isNotBlank().hasSize(min = 1, max = 50).isEmail()
}
}
}
Hello World
Hannah Fry / W. W. Norton Company / 2018-9 / GBP 17.99
A look inside the algorithms that are shaping our lives and the dilemmas they bring with them. If you were accused of a crime, who would you rather decide your sentence—a mathematically consistent ......一起来看看 《Hello World》 这本书的介绍吧!
