Make putted values optional in MetaBuilder
This commit is contained in:
parent
84c5f6d925
commit
ade4eec96e
@ -15,20 +15,20 @@ class MetaBuilder : AbstractMutableMeta<MetaBuilder>() {
|
|||||||
override fun wrapNode(meta: Meta): MetaBuilder = if (meta is MetaBuilder) meta else meta.builder()
|
override fun wrapNode(meta: Meta): MetaBuilder = if (meta is MetaBuilder) meta else meta.builder()
|
||||||
override fun empty(): MetaBuilder = MetaBuilder()
|
override fun empty(): MetaBuilder = MetaBuilder()
|
||||||
|
|
||||||
infix fun String.put(value: Value){
|
infix fun String.put(value: Value?) {
|
||||||
set(this, value)
|
set(this, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
infix fun String.put(string: String){
|
infix fun String.put(string: String?) {
|
||||||
set(this,string.asValue())
|
set(this, string?.asValue())
|
||||||
}
|
}
|
||||||
|
|
||||||
infix fun String.put(number: Number){
|
infix fun String.put(number: Number?) {
|
||||||
set(this,number.asValue())
|
set(this, number?.asValue())
|
||||||
}
|
}
|
||||||
|
|
||||||
infix fun String.put(boolean: Boolean){
|
infix fun String.put(boolean: Boolean?) {
|
||||||
set(this, boolean.asValue())
|
set(this, boolean?.asValue())
|
||||||
}
|
}
|
||||||
|
|
||||||
infix fun String.put(enum: Enum<*>) {
|
infix fun String.put(enum: Enum<*>) {
|
||||||
@ -58,12 +58,12 @@ class MetaBuilder : AbstractMutableMeta<MetaBuilder>() {
|
|||||||
set(this, Value.of(any))
|
set(this, Value.of(any))
|
||||||
}
|
}
|
||||||
|
|
||||||
infix fun String.put(meta: Meta) {
|
infix fun String.put(meta: Meta?) {
|
||||||
this@MetaBuilder[this] = meta
|
this@MetaBuilder[this] = meta
|
||||||
}
|
}
|
||||||
|
|
||||||
infix fun String.put(repr: MetaRepr){
|
infix fun String.put(repr: MetaRepr?) {
|
||||||
set(this,repr.toMeta())
|
set(this, repr?.toMeta())
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmName("putMetas")
|
@JvmName("putMetas")
|
||||||
@ -75,20 +75,20 @@ class MetaBuilder : AbstractMutableMeta<MetaBuilder>() {
|
|||||||
this@MetaBuilder[this] = MetaBuilder().apply(metaBuilder)
|
this@MetaBuilder[this] = MetaBuilder().apply(metaBuilder)
|
||||||
}
|
}
|
||||||
|
|
||||||
infix fun Name.put(value: Value){
|
infix fun Name.put(value: Value?) {
|
||||||
set(this, value)
|
set(this, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
infix fun Name.put(string: String){
|
infix fun Name.put(string: String?) {
|
||||||
set(this,string.asValue())
|
set(this, string?.asValue())
|
||||||
}
|
}
|
||||||
|
|
||||||
infix fun Name.put(number: Number){
|
infix fun Name.put(number: Number?) {
|
||||||
set(this,number.asValue())
|
set(this, number?.asValue())
|
||||||
}
|
}
|
||||||
|
|
||||||
infix fun Name.put(boolean: Boolean){
|
infix fun Name.put(boolean: Boolean?) {
|
||||||
set(this, boolean.asValue())
|
set(this, boolean?.asValue())
|
||||||
}
|
}
|
||||||
|
|
||||||
infix fun Name.put(enum: Enum<*>) {
|
infix fun Name.put(enum: Enum<*>) {
|
||||||
@ -100,12 +100,12 @@ class MetaBuilder : AbstractMutableMeta<MetaBuilder>() {
|
|||||||
set(this, iterable.asValue())
|
set(this, iterable.asValue())
|
||||||
}
|
}
|
||||||
|
|
||||||
infix fun Name.put(meta: Meta) {
|
infix fun Name.put(meta: Meta?) {
|
||||||
this@MetaBuilder[this] = meta
|
this@MetaBuilder[this] = meta
|
||||||
}
|
}
|
||||||
|
|
||||||
infix fun Name.put(repr: MetaRepr){
|
infix fun Name.put(repr: MetaRepr?) {
|
||||||
set(this,repr.toMeta())
|
set(this, repr?.toMeta())
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmName("putMetas")
|
@JvmName("putMetas")
|
||||||
|
Loading…
Reference in New Issue
Block a user