Skip to content
muune edited this page Feb 28, 2019 · 17 revisions

ChDate[목차]

ChMath[목차]

ChReflect[목차]

statement[목차]

Type 확장함수[목차]

Boolean

String

List

MutableList

MutableMap

JSONArray

ChDate

  • Date 대한 함수들 모음

Ch.date.offset()

Ch.date.offset():Int
  • Date의 offset을 리턴함

ChMath

  • Math 대한 함수들 모음

Ch.math.rand()

Ch.math.rand(start:Int, end:Int):Int
Ch.math.rand(start:Double, end:Double):Int
  • start(포함)~end(포함)까지의 랜덤 수를 리턴함
val s = Ch.math.rand(1.5, 2.0)
val a = Ch.math.rand(0.2, 0.5)
val r = Ch.math.rand(-37.0, 37.0)

ChReflect

Ch.reflect.fields()

fields(cls: KClass<*>):Item

statement

_try()

_try(block:()->T)
  • try catch 함수
  • inline함수
_try{Ch.model.jsonToModel(json, arg[0])}?.let{
    res.result = it
    return@ch true
}
_try{JSONObject("$v")}?.let{
    res.extra[EXTRA_JSON] = it
    res.result = it
    true
}
_try{Ch.sql.db("seller")}?.let {
    val v = it.select("se_get") { User() }
    if (v.isNotEmpty()) {
        App.user = v[0]
        ...
    }
}

_requiredNotNull()

_requiredNotNull(vararg v:Any?, block:()->Unit)
Clone this wiki locally