reified mapAsObject
This commit is contained in:
parent
6f8de045e1
commit
580cfd53da
@ -263,10 +263,10 @@ data class RenderTemplate(
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val ADAPTER = FactoryAdapter.Builder(RenderTemplate::class)
|
val ADAPTER = FactoryAdapter.Builder(RenderTemplate::class)
|
||||||
.mapAsObject(RenderTemplate::pieces, RenderPiece::class.java)
|
.mapAsObject(RenderTemplate::pieces)
|
||||||
.auto(RenderTemplate::representativePiece)
|
.auto(RenderTemplate::representativePiece)
|
||||||
.list(RenderTemplate::matches, RenderMatchList::class.java)
|
.autoList(RenderTemplate::matches)
|
||||||
.mapAsObject(RenderTemplate::rules, RenderRuleList::class.java)
|
.mapAsObject(RenderTemplate::rules)
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
val CACHE = ADAPTER.asReference()
|
val CACHE = ADAPTER.asReference()
|
||||||
|
@ -560,6 +560,15 @@ class FactoryAdapter<T : Any> private constructor(
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Добавляет поле-таблицу, которое кодируется как {"a": value, "b": value, ...}
|
||||||
|
*
|
||||||
|
* Таблица неизменяема (создаётся объект [ImmutableMap])
|
||||||
|
*/
|
||||||
|
inline fun <reified V> mapAsObject(field: KProperty1<T, Map<String, V>?>): Builder<T> {
|
||||||
|
return mapAsObject(field, V::class.java)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Добавляет поле-таблицу, которое кодируется как {"a": value, "b": value, ...}
|
* Добавляет поле-таблицу, которое кодируется как {"a": value, "b": value, ...}
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user