Make putted values optional in MetaBuilder
This commit is contained in:
parent
84c5f6d925
commit
ade4eec96e
@ -15,55 +15,55 @@ 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<*>) {
|
||||||
set(this, EnumValue(enum))
|
set(this, EnumValue(enum))
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmName("putValues")
|
@JvmName("putValues")
|
||||||
infix fun String.put(iterable: Iterable<Value>){
|
infix fun String.put(iterable: Iterable<Value>) {
|
||||||
set(this, iterable.asValue())
|
set(this, iterable.asValue())
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmName("putNumbers")
|
@JvmName("putNumbers")
|
||||||
infix fun String.put(iterable: Iterable<Number>){
|
infix fun String.put(iterable: Iterable<Number>) {
|
||||||
set(this, iterable.map { it.asValue() }.asValue())
|
set(this, iterable.map { it.asValue() }.asValue())
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmName("putStrings")
|
@JvmName("putStrings")
|
||||||
infix fun String.put(iterable: Iterable<String>){
|
infix fun String.put(iterable: Iterable<String>) {
|
||||||
set(this, iterable.map { it.asValue() }.asValue())
|
set(this, iterable.map { it.asValue() }.asValue())
|
||||||
}
|
}
|
||||||
|
|
||||||
infix fun String.put(array: DoubleArray){
|
infix fun String.put(array: DoubleArray) {
|
||||||
set(this, array.asValue())
|
set(this, array.asValue())
|
||||||
}
|
}
|
||||||
|
|
||||||
infix fun String.putValue(any: Any?){
|
infix fun String.putValue(any: Any?) {
|
||||||
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,37 +75,37 @@ 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<*>) {
|
||||||
set(this, EnumValue(enum))
|
set(this, EnumValue(enum))
|
||||||
}
|
}
|
||||||
|
|
||||||
@JvmName("putValues")
|
@JvmName("putValues")
|
||||||
infix fun Name.put(iterable: Iterable<Value>){
|
infix fun Name.put(iterable: Iterable<Value>) {
|
||||||
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